linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] adjust gfp mask passed on nested vmalloc() invocation (v2)
@ 2009-10-07 12:45 Jan Beulich
  2009-10-07 13:55 ` Hugh Dickins
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2009-10-07 12:45 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, hugh.dickins, linux-kernel

- 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

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Cc: Hugh Dickins <hugh.dickins@tiscali.co.uk>

---
 mm/vmalloc.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

--- linux-2.6.32-rc3/mm/vmalloc.c	2009-10-05 11:59:56.000000000 +0200
+++ 2.6.32-rc3-vmalloc-nested-gfp/mm/vmalloc.c	2009-10-07 14:39:38.000000000 +0200
@@ -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 majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] adjust gfp mask passed on nested vmalloc() invocation (v2)
  2009-10-07 12:45 [PATCH] adjust gfp mask passed on nested vmalloc() invocation (v2) Jan Beulich
@ 2009-10-07 13:55 ` Hugh Dickins
  2009-10-07 14:26   ` Jan Beulich
  0 siblings, 1 reply; 3+ messages in thread
From: Hugh Dickins @ 2009-10-07 13:55 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Andrew Morton, linux-mm, linux-kernel

On Wed, 7 Oct 2009, Jan Beulich wrote:

> - 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
> 
> Signed-off-by: Jan Beulich <jbeulich@novell.com>
> Cc: Hugh Dickins <hugh.dickins@tiscali.co.uk>

The patch looks good to me now, much nicer, thanks:
Acked-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>

> 
> ---
>  mm/vmalloc.c |    7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> --- linux-2.6.32-rc3/mm/vmalloc.c	2009-10-05 11:59:56.000000000 +0200
> +++ 2.6.32-rc3-vmalloc-nested-gfp/mm/vmalloc.c	2009-10-07 14:39:38.000000000 +0200
> @@ -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 majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] adjust gfp mask passed on nested vmalloc() invocation  (v2)
  2009-10-07 13:55 ` Hugh Dickins
@ 2009-10-07 14:26   ` Jan Beulich
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2009-10-07 14:26 UTC (permalink / raw)
  To: Hugh Dickins; +Cc: linux-mm, Andrew Morton, linux-kernel

>>> Hugh Dickins <hugh.dickins@tiscali.co.uk> 07.10.09 15:55 >>>
>On Wed, 7 Oct 2009, Jan Beulich wrote:
>
>> - 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 majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-10-07 14:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-07 12:45 [PATCH] adjust gfp mask passed on nested vmalloc() invocation (v2) Jan Beulich
2009-10-07 13:55 ` Hugh Dickins
2009-10-07 14:26   ` Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).