Skip to content

Commit 11969d6

Browse files
sudeep-hollagregkh
authored andcommitted
cacheinfo: Use atomic allocation for percpu cache attributes
On couple of architectures like RISC-V and ARM64, we need to detect cache attribues quite early during the boot when the secondary CPUs start. So we will call detect_cache_attributes in the atomic context and since use of normal allocation can sleep, we will end up getting "sleeping in the atomic context" bug splat. In order avoid that, move the allocation to use atomic version in preparation to move the actual detection of cache attributes in the CPU hotplug path which is atomic. Cc: Ionela Voinescu <[email protected]> Tested-by: Conor Dooley <[email protected]> Signed-off-by: Sudeep Holla <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 7ee951a commit 11969d6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/base/cacheinfo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ int detect_cache_attributes(unsigned int cpu)
356356
return -ENOENT;
357357

358358
per_cpu_cacheinfo(cpu) = kcalloc(cache_leaves(cpu),
359-
sizeof(struct cacheinfo), GFP_KERNEL);
359+
sizeof(struct cacheinfo), GFP_ATOMIC);
360360
if (per_cpu_cacheinfo(cpu) == NULL) {
361361
cache_leaves(cpu) = 0;
362362
return -ENOMEM;

0 commit comments

Comments
 (0)