[lvc-project] [PATCH] x86/smpboot: Mark memory allocations in smp_prepare_cpus_common __GFP_NOFAIL
Nikita Kiryushin
kiryushin at ancud.ru
Wed Jul 10 21:42:40 MSK 2024
As of now, zalloc_cpumask_var_node for various maps in
smp_prepare_cpus_common is not checked.
As memory allocations here are critical and there is no reasonable
allocation failure policy, the allocations should never fail.
Use __GFP_NOFAIL flag, as suggested in
https://lore.kernel.org/all/ZhaUZFY5MUyy6hWK@gmail.com/
Signed-off-by: Nikita Kiryushin <kiryushin at ancud.ru>
---
arch/x86/kernel/smpboot.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 0c35207320cb..76fabb74b8ea 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1044,11 +1044,11 @@ void __init smp_prepare_cpus_common(void)
for_each_possible_cpu(cpu) {
node = cpu_to_node(cpu);
- zalloc_cpumask_var_node(&per_cpu(cpu_sibling_map, cpu), GFP_KERNEL, node);
- zalloc_cpumask_var_node(&per_cpu(cpu_core_map, cpu), GFP_KERNEL, node);
- zalloc_cpumask_var_node(&per_cpu(cpu_die_map, cpu), GFP_KERNEL, node);
- zalloc_cpumask_var_node(&per_cpu(cpu_llc_shared_map, cpu), GFP_KERNEL, node);
- zalloc_cpumask_var_node(&per_cpu(cpu_l2c_shared_map, cpu), GFP_KERNEL, node);
+ zalloc_cpumask_var_node(&per_cpu(cpu_sibling_map, cpu), GFP_KERNEL | __GFP_NOFAIL, node);
+ zalloc_cpumask_var_node(&per_cpu(cpu_core_map, cpu), GFP_KERNEL | __GFP_NOFAIL, node);
+ zalloc_cpumask_var_node(&per_cpu(cpu_die_map, cpu), GFP_KERNEL | __GFP_NOFAIL, node);
+ zalloc_cpumask_var_node(&per_cpu(cpu_llc_shared_map, cpu), GFP_KERNEL | __GFP_NOFAIL, node);
+ zalloc_cpumask_var_node(&per_cpu(cpu_l2c_shared_map, cpu), GFP_KERNEL | __GFP_NOFAIL, node);
}
set_cpu_sibling_map(0);
--
2.34.1
More information about the lvc-project
mailing list