Skip to contentSkip to conversation

adjust gfp mask passed on nested vmalloc() invocation (v2)

PATCH In review Jan Beulich 2 participants 3 messages Oct 7, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 adjust gfp mask passed on nested vmalloc() invocation (v2)

- avoid wasting more precious resources (DMA or DMA32 pools), when being called through vmalloc_32{,_user}()
- explicitly allow using high memory here even if the outer allocation request doesn't allow it, unless is collides with __GFP_ZERO

---
 mm/vmalloc.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
mm/vmalloc.c +3 -4
@@ -1410,6 +1410,7 @@ static void *__vmalloc_area_node(struct 
 {
 	struct page **pages;
 	unsigned int nr_pages, array_size, i;
+	gfp_t nested_gfp = (gfp_mask & GFP_RECLAIM_MASK) | __GFP_ZERO;
 
 	nr_pages = (area->size - PAGE_SIZE) >> PAGE_SHIFT;
 	array_size = (nr_pages * sizeof(struct page *));
@@ -1417,13 +1418,11 @@ static void *__vmalloc_area_node(struct 
 	area->nr_pages = nr_pages;
 	/* Please note that the recursion is strictly bounded. */
 	if (array_size > PAGE_SIZE) {
-		pages = __vmalloc_node(array_size, gfp_mask | __GFP_ZERO,
+		pages = __vmalloc_node(array_size, nested_gfp | __GFP_HIGHMEM,
 				PAGE_KERNEL, node, caller);
 		area->flags |= VM_VPAGES;
 	} else {
-		pages = kmalloc_node(array_size,
-				(gfp_mask & GFP_RECLAIM_MASK) | __GFP_ZERO,
-				node);
+		pages = kmalloc_node(array_size, nested_gfp, node);
 	}
 	area->pages = pages;
 	area->caller = caller;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Jan Beulich

- avoid wasting more precious resources (DMA or DMA32 pools), when being called through vmalloc_32{,_user}()
- explicitly allow using high memory here even if the outer allocation request doesn't allow it, unless is collides with __GFP_ZERO

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ that's no longer an issue in the patch

Quoted 3 lines

The patch looks good to me now, much nicer, thanks:

Quoted 21 lines
---
 mm/vmalloc.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
mm/vmalloc.c +2 -1
@@ -1410,6 +1410,7 @@ static void *__vmalloc_area_node(struct 
 {
 	struct page **pages;
 	unsigned int nr_pages, array_size, i;
+	gfp_t nested_gfp = (gfp_mask & GFP_RECLAIM_MASK) | __GFP_ZERO;
 
 	nr_pages = (area->size - PAGE_SIZE) >> PAGE_SHIFT;
 	array_size = (nr_pages * sizeof(struct page *));
@@ -1417,13 +1418,11 @@ static void *__vmalloc_area_node(struct 
 	area->nr_pages = nr_pages;
 	/* Please note that the recursion is strictly bounded. */
 	if (array_size > PAGE_SIZE) {
-		pages = __vmalloc_node(array_size, gfp_mask | __GFP_ZERO,
+		pages = __vmalloc_node(array_size, nested_gfp | __GFP_HIGHMEM,

mm/vmalloc.c static void *__vmalloc_area_node(struct · line 1428

Quoted 10 lines
mm/vmalloc.c +1 -3
 				PAGE_KERNEL, node, caller);
 		area->flags |= VM_VPAGES;
 	} else {
-		pages = kmalloc_node(array_size,
-				(gfp_mask & GFP_RECLAIM_MASK) | __GFP_ZERO,
-				node);
+		pages = kmalloc_node(array_size, nested_gfp, node);
 	}
 	area->pages = pages;
 	area->caller = caller;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw
Quoted 9 lines
Quoted 1 line
Quoted 1 line

Hugh Dickins <[email protected]> 07.10.09 15:55 >>>

Quoted 4 lines · Jan Beulich

- avoid wasting more precious resources (DMA or DMA32 pools), when being called through vmalloc_32{,_user}()
- explicitly allow using high memory here even if the outer allocation request doesn't allow it, unless is collides with __GFP_ZERO

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ that's no longer an issue in the patch

Oops. Will send out a corrected version in a second.

Jan

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>