mm: vmalloc: correct use of __GFP_NOWARN mask in __vmalloc_area_node()
Subsystems (2)
PATCH 1/1 mm: vmalloc: correct use of __GFP_NOWARN mask in __vmalloc_area_node()
This function invokes warn_alloc() with __GFP_NOWARN set which is a no-op. Set this flag _after_ this call so it is actually invoked, and additionally remove a duplicate application of __GFP_NOWARN afterwards.
--- mm/vmalloc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
mm/vmalloc.c +4 -2
@@ -3031,7 +3031,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,int ret; array_size = (unsigned long )nr_small_pages *sizeof (struct page *); - gfp_mask |= __GFP_NOWARN; +if (!(gfp_mask & (GFP_DMA |GFP_DMA32 ))) gfp_mask |= __GFP_HIGHMEM;
@@ -3051,10 +3051,12 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,return NULL ; } + gfp_mask |= __GFP_NOWARN; +set_vm_area_page_order (area, page_shift -PAGE_SHIFT ); page_order =vm_area_page_order (area); - area->nr_pages =vm_area_alloc_pages (gfp_mask | __GFP_NOWARN, + area->nr_pages =vm_area_alloc_pages (gfp_mask, node, page_order, nr_small_pages, area->pages);atomic_long_add (area->nr_pages, &nr_vmalloc_pages);
--
2.38.1
Uladzislau Rezki
maintainerQuoted 23 lines · Lorenzo Stoakes
This function invokes
warn_alloc()with__GFP_NOWARNset which is a no-op. Set this flag _after_ this call so it is actually invoked, and additionally remove a duplicate application of__GFP_NOWARNafterwards.Signed-off-by Lorenzo Stoakes <[email protected]>--- mm/vmalloc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)mm/vmalloc.c +1
-1@@ -3031,7 +3031,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,int ret; array_size = (unsigned long )nr_small_pages *sizeof (struct page *); - gfp_mask |= __GFP_NOWARN; +if (!(gfp_mask & (GFP_DMA |GFP_DMA32 ))) gfp_mask |= __GFP_HIGHMEM;
mm/vmalloc.c static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, · line 3056
Quoted 6 lines
mm/vmalloc.c +2
-0@@ -3051,10 +3051,12 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,return NULL ; } + gfp_mask |= __GFP_NOWARN; +
There are three more warn_alloc()s below. Those are explicitly disabled. Could you please rework the patch and make it working also?
--
Uladzislau Rezki
Quoted 2 lines · Uladzislau Rezki
There are three more warn_alloc()s below. Those are explicitly disabled. Could you please rework the patch and make it working also?
Ah yes, sorry missed those, I think then the simplest solution then would be to simply yank the __GFP_NOWARN specifier at the top of the function and restore the explicit flag being passed to vm_area_alloc_pages() you added in c3d77172dfc0.
This whole thing does make me wonder if this function is due a more general refactor.
Will spin up a v2!