Skip to content

Commit d45c6ef

Browse files
virtuosogregkh
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 #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 e73b547 commit d45c6ef

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
@@ -682,7 +682,7 @@ static void stm_device_release(struct device *dev)
682682
{
683683
struct stm_device *stm = to_stm_device(dev);
684684

685-
kfree(stm);
685+
vfree(stm);
686686
}
687687

688688
int stm_register_device(struct device *parent, struct stm_data *stm_data,
@@ -699,7 +699,7 @@ int stm_register_device(struct device *parent, struct stm_data *stm_data,
699699
return -EINVAL;
700700

701701
nmasters = stm_data->sw_end - stm_data->sw_start + 1;
702-
stm = kzalloc(sizeof(*stm) + nmasters * sizeof(void *), GFP_KERNEL);
702+
stm = vzalloc(sizeof(*stm) + nmasters * sizeof(void *));
703703
if (!stm)
704704
return -ENOMEM;
705705

@@ -752,7 +752,7 @@ int stm_register_device(struct device *parent, struct stm_data *stm_data,
752752
/* matches device_initialize() above */
753753
put_device(&stm->dev);
754754
err_free:
755-
kfree(stm);
755+
vfree(stm);
756756

757757
return err;
758758
}

0 commit comments

Comments
 (0)