Skip to content

Commit a790b50

Browse files
virtuosoZhengShunQian
authored andcommitted
stm class: Use vmalloc for the master map
commit b5e2ced upstream. Fengguang is running into a warning from the buddy allocator: > swapper/0: page allocation failure: order:9, mode:0x14040c0(GFP_KERNEL|__GFP_COMP), nodemask=(null) > CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.17.0-rc1 torvalds#262 > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014 > Call Trace: ... > __kmalloc+0x14b/0x180: ____cache_alloc at mm/slab.c:3127 > stm_register_device+0xf3/0x5c0: stm_register_device at drivers/hwtracing/stm/core.c:695 ... Which is basically a result of the stm class trying to allocate ~512kB for the dummy_stm with its default parameters. There's no reason, however, for it not to be vmalloc()ed instead, which is what this patch does. Reported-by: Fengguang Wu <[email protected]> Signed-off-by: Alexander Shishkin <[email protected]> CC: [email protected] # v4.4+ Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent af7913e commit a790b50

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/hwtracing/stm/core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ static void stm_device_release(struct device *dev)
650650
{
651651
struct stm_device *stm = to_stm_device(dev);
652652

653-
kfree(stm);
653+
vfree(stm);
654654
}
655655

656656
int stm_register_device(struct device *parent, struct stm_data *stm_data,
@@ -667,7 +667,7 @@ int stm_register_device(struct device *parent, struct stm_data *stm_data,
667667
return -EINVAL;
668668

669669
nmasters = stm_data->sw_end - stm_data->sw_start;
670-
stm = kzalloc(sizeof(*stm) + nmasters * sizeof(void *), GFP_KERNEL);
670+
stm = vzalloc(sizeof(*stm) + nmasters * sizeof(void *));
671671
if (!stm)
672672
return -ENOMEM;
673673

@@ -709,7 +709,7 @@ int stm_register_device(struct device *parent, struct stm_data *stm_data,
709709
/* matches device_initialize() above */
710710
put_device(&stm->dev);
711711
err_free:
712-
kfree(stm);
712+
vfree(stm);
713713

714714
return err;
715715
}

0 commit comments

Comments
 (0)