public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc: don't pass GFP_WAIT to kmalloc() from *_maybe_bootmem()
@ 2009-06-12  9:22 Pekka J Enberg
  2009-06-12  9:34 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 2+ messages in thread
From: Pekka J Enberg @ 2009-06-12  9:22 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linux-kernel, npiggin, mingo

From: Pekka Enberg <penberg@cs.helsinki.fi>

As slab is initialized much earlier now, we must not pass GFP_WAIT to kmalloc()
from *_maybe_bootmem() functions; otherwise slab allocators will enable
interrupts.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
Ben, while we're discussing the slab side of things, can we go ahead and 
merge this one? It should fix plenty of cases for powerpc.

 arch/powerpc/lib/alloc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/lib/alloc.c b/arch/powerpc/lib/alloc.c
index f53e09c..56b35e3 100644
--- a/arch/powerpc/lib/alloc.c
+++ b/arch/powerpc/lib/alloc.c
@@ -9,7 +9,7 @@
 void * __init_refok alloc_maybe_bootmem(size_t size, gfp_t mask)
 {
 	if (mem_init_done)
-		return kmalloc(size, mask);
+		return kmalloc(size, mask & ~__GFP_WAIT);
 	else
 		return alloc_bootmem(size);
 }
@@ -19,7 +19,7 @@ void * __init_refok zalloc_maybe_bootmem(size_t size, gfp_t mask)
 	void *p;
 
 	if (mem_init_done)
-		p = kzalloc(size, mask);
+		p = kzalloc(size, mask & ~__GFP_WAIT);
 	else {
 		p = alloc_bootmem(size);
 		if (p)
-- 
1.6.0.4


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

* Re: [PATCH] powerpc: don't pass GFP_WAIT to kmalloc() from *_maybe_bootmem()
  2009-06-12  9:22 [PATCH] powerpc: don't pass GFP_WAIT to kmalloc() from *_maybe_bootmem() Pekka J Enberg
@ 2009-06-12  9:34 ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2009-06-12  9:34 UTC (permalink / raw)
  To: Pekka J Enberg; +Cc: linux-kernel, npiggin, mingo

On Fri, 2009-06-12 at 12:22 +0300, Pekka J Enberg wrote:
> From: Pekka Enberg <penberg@cs.helsinki.fi>
> 
> As slab is initialized much earlier now, we must not pass GFP_WAIT to kmalloc()
> from *_maybe_bootmem() functions; otherwise slab allocators will enable
> interrupts.
> 
> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
> ---
> Ben, while we're discussing the slab side of things, can we go ahead and 
> merge this one? It should fix plenty of cases for powerpc.

We can, but it's a plaster... I won't fix it all, and again, what tells
you that things calling alloc_maybe_bootmem() don't do that specifically
-because- they can be called also much later ? (In this case, it's
__init so I'm not going to object, but I still think it's unnecessary if
we fix it properly).

Cheers,
Ben.

>  arch/powerpc/lib/alloc.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/lib/alloc.c b/arch/powerpc/lib/alloc.c
> index f53e09c..56b35e3 100644
> --- a/arch/powerpc/lib/alloc.c
> +++ b/arch/powerpc/lib/alloc.c
> @@ -9,7 +9,7 @@
>  void * __init_refok alloc_maybe_bootmem(size_t size, gfp_t mask)
>  {
>  	if (mem_init_done)
> -		return kmalloc(size, mask);
> +		return kmalloc(size, mask & ~__GFP_WAIT);
>  	else
>  		return alloc_bootmem(size);
>  }
> @@ -19,7 +19,7 @@ void * __init_refok zalloc_maybe_bootmem(size_t size, gfp_t mask)
>  	void *p;
>  
>  	if (mem_init_done)
> -		p = kzalloc(size, mask);
> +		p = kzalloc(size, mask & ~__GFP_WAIT);
>  	else {
>  		p = alloc_bootmem(size);
>  		if (p)


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

end of thread, other threads:[~2009-06-12  9:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-12  9:22 [PATCH] powerpc: don't pass GFP_WAIT to kmalloc() from *_maybe_bootmem() Pekka J Enberg
2009-06-12  9:34 ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox