Skip to content

Commit

Permalink
mm/vmalloc: remove gfpflags_allow_blocking() check
Browse files Browse the repository at this point in the history
Get rid of gfpflags_allow_blocking() check from the vmalloc() path as it
is supposed to be sleepable anyway.  Thus remove it from the
alloc_vmap_area() as well as from the vm_area_alloc_pages().

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Uladzislau Rezki (Sony) <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Cc: Nicholas Piggin <[email protected]>
Cc: Hillf Danton <[email protected]>
Cc: Oleksiy Avramchenko <[email protected]>
Cc: Steven Rostedt <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
urezki authored and torvalds committed Sep 3, 2021
1 parent 343ab81 commit 12e376a
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions mm/vmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,7 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
int node, gfp_t gfp_mask)
{
struct vmap_area *va;
unsigned long freed;
unsigned long addr;
int purged = 0;
int ret;
Expand Down Expand Up @@ -1542,13 +1543,12 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
goto retry;
}

if (gfpflags_allow_blocking(gfp_mask)) {
unsigned long freed = 0;
blocking_notifier_call_chain(&vmap_notify_list, 0, &freed);
if (freed > 0) {
purged = 0;
goto retry;
}
freed = 0;
blocking_notifier_call_chain(&vmap_notify_list, 0, &freed);

if (freed > 0) {
purged = 0;
goto retry;
}

if (!(gfp_mask & __GFP_NOWARN) && printk_ratelimit())
Expand Down Expand Up @@ -2838,9 +2838,7 @@ vm_area_alloc_pages(gfp_t gfp, int nid,
for (i = 0; i < (1U << order); i++)
pages[nr_allocated + i] = page + i;

if (gfpflags_allow_blocking(gfp))
cond_resched();

cond_resched();
nr_allocated += 1U << order;
}

Expand Down

0 comments on commit 12e376a

Please sign in to comment.