aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/lib
diff options
context:
space:
mode:
authorTimur Tabi <timur@freescale.com>2008-04-14 11:43:38 -0400
committerKumar Gala <galak@kernel.crashing.org>2008-04-17 10:50:38 -0400
commit3a2f020c5a93a88aa09adbe56dde43463324930a (patch)
treee178a2fa9406fed6f6783e3f095732fea28b91c9 /arch/powerpc/lib
parent998c610363b26f3793ad8121eeb3a749b1034824 (diff)
[POWERPC] Make rheap safe for spinlocks
The rheap allocation function, rh_alloc, could call kmalloc with GFP_KERNEL. This can sleep, which means you couldn't hold a spinlock while called rh_alloc. Change all kmalloc calls to use GFP_ATOMIC so that it won't sleep. This is safe because only small blocks are allocated. Signed-off-by: Timur Tabi <timur@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/lib')
-rw-r--r--arch/powerpc/lib/rheap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/powerpc/lib/rheap.c b/arch/powerpc/lib/rheap.c
index 22c3b4f53de7..29b2941cada0 100644
--- a/arch/powerpc/lib/rheap.c
+++ b/arch/powerpc/lib/rheap.c
@@ -54,7 +54,7 @@ static int grow(rh_info_t * info, int max_blocks)
54 54
55 new_blocks = max_blocks - info->max_blocks; 55 new_blocks = max_blocks - info->max_blocks;
56 56
57 block = kmalloc(sizeof(rh_block_t) * max_blocks, GFP_KERNEL); 57 block = kmalloc(sizeof(rh_block_t) * max_blocks, GFP_ATOMIC);
58 if (block == NULL) 58 if (block == NULL)
59 return -ENOMEM; 59 return -ENOMEM;
60 60
@@ -258,7 +258,7 @@ rh_info_t *rh_create(unsigned int alignment)
258 if ((alignment & (alignment - 1)) != 0) 258 if ((alignment & (alignment - 1)) != 0)
259 return ERR_PTR(-EINVAL); 259 return ERR_PTR(-EINVAL);
260 260
261 info = kmalloc(sizeof(*info), GFP_KERNEL); 261 info = kmalloc(sizeof(*info), GFP_ATOMIC);
262 if (info == NULL) 262 if (info == NULL)
263 return ERR_PTR(-ENOMEM); 263 return ERR_PTR(-ENOMEM);
264 264