mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-07 09:55:19 +02:00
dm persistent data: fix memory allocation failure
commit faada2174c
upstream.
kmalloc is unreliable when allocating more than 8 pages of memory. It may
fail when there is plenty of free memory but the memory is fragmented.
Zdenek Kabelac observed such failure in his tests.
This commit changes kmalloc to kvmalloc - kvmalloc will fall back to
vmalloc if the large allocation fails.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Reviewed-by: Mike Snitzer <snitzer@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
00df2f4868
commit
a6bba25f15
|
@ -277,7 +277,7 @@ static void sm_metadata_destroy(struct dm_space_map *sm)
|
||||||
{
|
{
|
||||||
struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm);
|
struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm);
|
||||||
|
|
||||||
kfree(smm);
|
kvfree(smm);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sm_metadata_get_nr_blocks(struct dm_space_map *sm, dm_block_t *count)
|
static int sm_metadata_get_nr_blocks(struct dm_space_map *sm, dm_block_t *count)
|
||||||
|
@ -772,7 +772,7 @@ struct dm_space_map *dm_sm_metadata_init(void)
|
||||||
{
|
{
|
||||||
struct sm_metadata *smm;
|
struct sm_metadata *smm;
|
||||||
|
|
||||||
smm = kmalloc(sizeof(*smm), GFP_KERNEL);
|
smm = kvmalloc(sizeof(*smm), GFP_KERNEL);
|
||||||
if (!smm)
|
if (!smm)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user