summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinchan Kim <minchan@google.com>2022-06-22 11:02:47 -0700
committerMinchan Kim <minchan@google.com>2022-06-22 22:10:22 +0000
commitb3bf5762975c82a2d3377f304647dae1d50ef150 (patch)
treeda63de9d67ef73d7961eb5d28e85eb485580aa6c
parent50a3e50660372ebfcf976678e468f513dc7ffa85 (diff)
downloadaoc-b3bf5762975c82a2d3377f304647dae1d50ef150.tar.gz
use vmalloc for 128K buffer
Linux is fragile to allocate 128 contiguous memory. If we don't need really contiguos memory, we could use vmalloc instead. [89177.006984][ T4965] kworker/4:2: page allocation failure: order:5, mode:0x40cc0(GFP_KERNEL|__GFP_COMP), nodemask=(null),cpuset=/,mems_allowed=0 [89177.007028][ T4965] CPU: 4 PID: 4965 Comm: kworker/4:2 Tainted: G W OE 5.10.107-android13-4-688017-g3451713fa3b5-ab8740660 #1 [89177.007040][ T4965] Hardware name: GS201 CHEETAH EVT 1.1 based on GS201 (DT) [89177.007117][ T4965] Workqueue: events aoc_watchdog.cfi_jt [aoc_core] [89177.007130][ T4965] Call trace: [89177.007157][ T4965] dump_backtrace.cfi_jt+0x0/0x8 [89177.007183][ T4965] dump_stack_lvl+0xc0/0x13c [89177.007201][ T4965] warn_alloc+0x160/0x1d0 [89177.007215][ T4965] __alloc_pages_slowpath+0xbe4/0xdd4 [89177.007229][ T4965] __alloc_pages_nodemask+0x1fc/0x3b4 [89177.007245][ T4965] kmalloc_order+0x48/0x1c8 [89177.007257][ T4965] kmalloc_order_trace+0x34/0x168 [89177.007269][ T4965] __kmalloc+0x504/0x7a0 [89177.007326][ T4965] aoc_watchdog+0x298/0x558 [aoc_core] [89177.007343][ T4965] process_one_work+0x24c/0x5bc [89177.007355][ T4965] worker_thread+0x3e8/0xa50 [89177.007368][ T4965] kthread+0x150/0x1b4 [89177.007383][ T4965] ret_from_fork+0x10/0x30 Bug: 236684284 Signed-off-by: Minchan Kim <minchan@google.com> Change-Id: Ia3f0c90b1188867b12ccdc02eb258b9770022883
-rw-r--r--aoc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/aoc.c b/aoc.c
index 111686d..33f30c8 100644
--- a/aoc.c
+++ b/aoc.c
@@ -2544,11 +2544,11 @@ static void aoc_watchdog(struct work_struct *work)
}
num_pages = DIV_ROUND_UP(prvdata->dram_size, PAGE_SIZE);
- dram_pages = kmalloc_array(num_pages, sizeof(*dram_pages), GFP_KERNEL);
+ dram_pages = vmalloc(num_pages * sizeof(*dram_pages));
if (!dram_pages) {
dev_err(prvdata->dev,
"aoc coredump failed: alloc dram_pages failed\n");
- goto err_kmalloc;
+ goto err_vmalloc;
}
for (i = 0; i < num_pages; i++)
dram_pages[i] = phys_to_page(prvdata->dram_resource.start +
@@ -2613,8 +2613,8 @@ static void aoc_watchdog(struct work_struct *work)
if (dram_cached)
vunmap(dram_cached);
err_vmap:
- kfree(dram_pages);
-err_kmalloc:
+ vfree(dram_pages);
+err_vmalloc:
err_coredump:
/* make sure there is no AoC startup work active */
cancel_work_sync(&prvdata->online_work);