Re: [PATCH 1/4] mm: prevent potential recursive reclaim due to clearing PF_MEMALLOC

2017-04-05 Thread Michal Hocko
On Wed 05-04-17 09:46:57, Vlastimil Babka wrote: > The function __alloc_pages_direct_compact() sets PF_MEMALLOC to prevent > deadlock during page migration by lock_page() (see the comment in > __unmap_and_move()). Then it unconditionally clears the flag, which can clear > a > pre-existing PF_MEMAL

Re: [PATCH 4/4] mtd: nand: nandsim: convert to memalloc_noreclaim_*()

2017-04-05 Thread Michal Hocko
On Wed 05-04-17 09:47:00, Vlastimil Babka wrote: > Nandsim has own functions set_memalloc() and clear_memalloc() for robust > setting and clearing of PF_MEMALLOC. Replace them by the new generic helpers. > No functional change. This one smells like an abuser. Why the hell should read/write path to

[PATCH 4/4] mtd: nand: nandsim: convert to memalloc_noreclaim_*()

2017-04-05 Thread Vlastimil Babka
Nandsim has own functions set_memalloc() and clear_memalloc() for robust setting and clearing of PF_MEMALLOC. Replace them by the new generic helpers. No functional change. Signed-off-by: Vlastimil Babka Cc: Boris Brezillon Cc: Richard Weinberger --- drivers/mtd/nand/nandsim.c | 29 +--

Re: [PATCH 4/4] mtd: nand: nandsim: convert to memalloc_noreclaim_*()

2017-04-05 Thread Richard Weinberger
Michal, Am 05.04.2017 um 13:31 schrieb Michal Hocko: > On Wed 05-04-17 09:47:00, Vlastimil Babka wrote: >> Nandsim has own functions set_memalloc() and clear_memalloc() for robust >> setting and clearing of PF_MEMALLOC. Replace them by the new generic helpers. >> No functional change. > > This on

[PATCH 1/4] mm: prevent potential recursive reclaim due to clearing PF_MEMALLOC

2017-04-05 Thread Vlastimil Babka
The function __alloc_pages_direct_compact() sets PF_MEMALLOC to prevent deadlock during page migration by lock_page() (see the comment in __unmap_and_move()). Then it unconditionally clears the flag, which can clear a pre-existing PF_MEMALLOC flag and result in recursive reclaim. This was not a pro

Re: [PATCH 4/4] mtd: nand: nandsim: convert to memalloc_noreclaim_*()

2017-04-05 Thread Michal Hocko
On Wed 05-04-17 13:39:16, Vlastimil Babka wrote: > On 04/05/2017 01:36 PM, Richard Weinberger wrote: > > Michal, > > > > Am 05.04.2017 um 13:31 schrieb Michal Hocko: > >> On Wed 05-04-17 09:47:00, Vlastimil Babka wrote: > >>> Nandsim has own functions set_memalloc() and clear_memalloc() for robust

Re: [PATCH 1/4] mm: prevent potential recursive reclaim due to clearing PF_MEMALLOC

2017-04-05 Thread Andrey Ryabinin
On 04/05/2017 10:46 AM, Vlastimil Babka wrote: > The function __alloc_pages_direct_compact() sets PF_MEMALLOC to prevent > deadlock during page migration by lock_page() (see the comment in > __unmap_and_move()). Then it unconditionally clears the flag, which can clear > a > pre-existing PF_MEMALLO

[PATCH 0/4] more robust PF_MEMALLOC handling

2017-04-05 Thread Vlastimil Babka
Hi, this series aims to unify the setting and clearing of PF_MEMALLOC, which prevents recursive reclaim. There are some places that clear the flag unconditionally from current->flags, which may result in clearing a pre-existing flag. This already resulted in a bug report that Patch 1 fixes (withou

Re: [PATCH 2/4] mm: introduce memalloc_noreclaim_{save,restore}

2017-04-05 Thread Michal Hocko
On Wed 05-04-17 09:46:58, Vlastimil Babka wrote: > The previous patch has shown that simply setting and clearing PF_MEMALLOC in > current->flags can result in wrongly clearing a pre-existing PF_MEMALLOC flag > and potentially lead to recursive reclaim. Let's introduce helpers that > support > prop

[PATCH 2/4] mm: introduce memalloc_noreclaim_{save,restore}

2017-04-05 Thread Vlastimil Babka
The previous patch has shown that simply setting and clearing PF_MEMALLOC in current->flags can result in wrongly clearing a pre-existing PF_MEMALLOC flag and potentially lead to recursive reclaim. Let's introduce helpers that support proper nesting by saving the previous stat of the flag, similar

Re: [PATCH 3/4] treewide: convert PF_MEMALLOC manipulations to new helpers

2017-04-05 Thread Michal Hocko
On Wed 05-04-17 09:46:59, Vlastimil Babka wrote: > We now have memalloc_noreclaim_{save,restore} helpers for robust setting and > clearing of PF_MEMALLOC. Let's convert the code which was using the generic > tsk_restore_flags(). No functional change. It would be really great to revisit why those p

Re: [PATCH 4/4] mtd: nand: nandsim: convert to memalloc_noreclaim_*()

2017-04-05 Thread Vlastimil Babka
On 04/05/2017 01:36 PM, Richard Weinberger wrote: > Michal, > > Am 05.04.2017 um 13:31 schrieb Michal Hocko: >> On Wed 05-04-17 09:47:00, Vlastimil Babka wrote: >>> Nandsim has own functions set_memalloc() and clear_memalloc() for robust >>> setting and clearing of PF_MEMALLOC. Replace them by the

[PATCH 3/4] treewide: convert PF_MEMALLOC manipulations to new helpers

2017-04-05 Thread Vlastimil Babka
We now have memalloc_noreclaim_{save,restore} helpers for robust setting and clearing of PF_MEMALLOC. Let's convert the code which was using the generic tsk_restore_flags(). No functional change. Signed-off-by: Vlastimil Babka Cc: Josef Bacik Cc: Lee Duncan Cc: Chris Leech Cc: "David S. Miller

Re: [PATCH] libiscsi: use vzalloc for large allocations in iscsi_pool_init

2017-04-05 Thread Kyle Fortin
On Apr 3, 2017, at 3:46 PM, Chet L wrote: > > On Mon, Apr 3, 2017 at 6:30 AM, Kyle Fortin wrote: > >> >>for (i = 0; i < q->max; i++) >>kfree(q->pool[i]); >> - kfree(q->pool); >> + if (q->is_pool_vmalloc) > > you could do something like: > > if (is_vmalloc_