workqueue: Free useless memory when disabling NUMA in wq_numa_init()
PATCH 1/1 workqueue: Free useless memory when disabling NUMA in wq_numa_init()
From: Xunlei Pang <[email protected]>
wq_update_unbound_numa_attrs_buf and tbl will never be used in case of invalid NUMA node mapping, so just free them.
Signed-off-by Xunlei Pang <[email protected]>
--- kernel/workqueue.c | 7 +++++++ 1 file changed, 7 insertions(+)
kernel/workqueue.c +7 -0
@@ -5197,6 +5197,13 @@ static void __init wq_numa_init(void) node =cpu_to_node (cpu);if (WARN_ON (node ==NUMA_NO_NODE )) {pr_warn ("workqueue: NUMA node mapping not available for cpu%d, disabling NUMA support\n" , cpu); + +for_each_node (node) +free_cpumask_var (tbl[node]); +kfree (tbl); + +free_workqueue_attrs (wq_update_unbound_numa_attrs_buf); + wq_update_unbound_numa_attrs_buf =NULL ;/* happens iff arch is bonkers, let's just proceed */ return ; }
Signature · 1 line
1.9.1
Tejun Heo
maintainerHello,
Quoted 15 lines · Xunlei Pang
From: Xunlei Pang <[email protected]>
wq_update_unbound_numa_attrs_bufand tbl will never be used in case of invalid NUMA node mapping, so just free them.Signed-off-by Xunlei Pang <[email protected]>--- kernel/workqueue.c | 7 +++++++ 1 file changed, 7 insertions(+)kernel/workqueue.c +0
-0
kernel/workqueue.c static void __init wq_numa_init(void) · line 5203
Quoted 7 lines
kernel/workqueue.c +4
-0@@ -5197,6 +5197,13 @@ static void __init wq_numa_init(void) node =cpu_to_node (cpu);if (WARN_ON (node ==NUMA_NO_NODE )) {pr_warn ("workqueue: NUMA node mapping not available for cpu%d, disabling NUMA support\n" , cpu); + +for_each_node (node) +free_cpumask_var (tbl[node]); +kfree (tbl);
So, this is "either bios or arch code buggy but let's keep limping on rather than crashing" path. It doesn't matter whether there's something lingering behind. We wanna keep it as simple as possible.
Thanks.
Signature · 1 line
tejun