[S+Q 09/16] [percpu] make allocpercpu usable during early boot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



allocpercpu() may be used during early boot after the page allocator
has been bootstrapped but when interrupts are still off. Make sure
that we do not do GFP_KERNEL allocations if this occurs.

Cc: tj@xxxxxxxxxx
Signed-off-by: Christoph Lameter <cl@xxxxxxxxxxxxxxxxxxxx>

---
 mm/percpu.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Index: linux-2.6/mm/percpu.c
===================================================================
--- linux-2.6.orig/mm/percpu.c	2010-06-23 14:43:54.000000000 -0500
+++ linux-2.6/mm/percpu.c	2010-06-23 14:44:05.000000000 -0500
@@ -275,7 +275,8 @@ static void __maybe_unused pcpu_next_pop
  * memory is always zeroed.
  *
  * CONTEXT:
- * Does GFP_KERNEL allocation.
+ * Does GFP_KERNEL allocation (May be called early in boot when
+ * interrupts are still disabled. Will then do GFP_NOWAIT alloc).
  *
  * RETURNS:
  * Pointer to the allocated area on success, NULL on failure.
@@ -286,7 +287,7 @@ static void *pcpu_mem_alloc(size_t size)
 		return NULL;
 
 	if (size <= PAGE_SIZE)
-		return kzalloc(size, GFP_KERNEL);
+		return kzalloc(size, GFP_KERNEL & gfp_allowed_mask);
 	else {
 		void *ptr = vmalloc(size);
 		if (ptr)

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


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]