aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUladzislau Rezki (Sony) <[email protected]>2019-11-30 17:54:37 -0800
committerLinus Torvalds <[email protected]>2019-12-01 12:59:05 -0800
commitf07116d77b5b9a4fecdcb470fc6ea08378b98ff7 (patch)
tree148dfc7464ce714266a05c89ece856d016fc8083
parent81f1ba586e393ad43350bded96d1ec3c48674b00 (diff)
mm/vmalloc: respect passed gfp_mask when doing preloading
Allocation functions should comply with the given gfp_mask as much as possible. The preallocation code in alloc_vmap_area doesn't follow that pattern and it is using a hardcoded GFP_KERNEL. Although this doesn't really make much difference because vmalloc is not GFP_NOWAIT compliant in general (e.g. page table allocations are GFP_KERNEL) there is no reason to spread that bad habit and it is good to fix the antipattern. [[email protected]: rewrite changelog] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Uladzislau Rezki (Sony) <[email protected]> Acked-by: Michal Hocko <[email protected]> Cc: Daniel Wagner <[email protected]> Cc: Hillf Danton <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Oleksiy Avramchenko <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Sebastian Andrzej Siewior <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Thomas Gleixner <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r--mm/vmalloc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 90517b4b21ef..b3bb50d07e27 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1063,9 +1063,9 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
return ERR_PTR(-EBUSY);
might_sleep();
+ gfp_mask = gfp_mask & GFP_RECLAIM_MASK;
- va = kmem_cache_alloc_node(vmap_area_cachep,
- gfp_mask & GFP_RECLAIM_MASK, node);
+ va = kmem_cache_alloc_node(vmap_area_cachep, gfp_mask, node);
if (unlikely(!va))
return ERR_PTR(-ENOMEM);
@@ -1073,7 +1073,7 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
* Only scan the relevant parts containing pointers to other objects
* to avoid false negatives.
*/
- kmemleak_scan_area(&va->rb_node, SIZE_MAX, gfp_mask & GFP_RECLAIM_MASK);
+ kmemleak_scan_area(&va->rb_node, SIZE_MAX, gfp_mask);
retry:
/*
@@ -1099,7 +1099,7 @@ retry:
* Just proceed as it is. If needed "overflow" path
* will refill the cache we allocate from.
*/
- pva = kmem_cache_alloc_node(vmap_area_cachep, GFP_KERNEL, node);
+ pva = kmem_cache_alloc_node(vmap_area_cachep, gfp_mask, node);
spin_lock(&vmap_area_lock);