forked from Minki/linux
[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>
This commit is contained in:
parent
998c610363
commit
3a2f020c5a
@ -54,7 +54,7 @@ static int grow(rh_info_t * info, int max_blocks)
|
|||||||
|
|
||||||
new_blocks = max_blocks - info->max_blocks;
|
new_blocks = max_blocks - info->max_blocks;
|
||||||
|
|
||||||
block = kmalloc(sizeof(rh_block_t) * max_blocks, GFP_KERNEL);
|
block = kmalloc(sizeof(rh_block_t) * max_blocks, GFP_ATOMIC);
|
||||||
if (block == NULL)
|
if (block == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
@ -258,7 +258,7 @@ rh_info_t *rh_create(unsigned int alignment)
|
|||||||
if ((alignment & (alignment - 1)) != 0)
|
if ((alignment & (alignment - 1)) != 0)
|
||||||
return ERR_PTR(-EINVAL);
|
return ERR_PTR(-EINVAL);
|
||||||
|
|
||||||
info = kmalloc(sizeof(*info), GFP_KERNEL);
|
info = kmalloc(sizeof(*info), GFP_ATOMIC);
|
||||||
if (info == NULL)
|
if (info == NULL)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user