linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] workqueue: Free useless memory when disabling NUMA in wq_numa_init()
@ 2015-09-17  2:43 Xunlei Pang
  2015-09-17 15:29 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Xunlei Pang @ 2015-09-17  2:43 UTC (permalink / raw)
  To: linux-kernel, Tejun Heo, Lai Jiangshan; +Cc: Xunlei Pang

From: Xunlei Pang <pang.xunlei@zte.com.cn>

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 <pang.xunlei@zte.com.cn>
---
 kernel/workqueue.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index ca71582..22d7747 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -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;
 		}
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] workqueue: Free useless memory when disabling NUMA in wq_numa_init()
  2015-09-17  2:43 [PATCH] workqueue: Free useless memory when disabling NUMA in wq_numa_init() Xunlei Pang
@ 2015-09-17 15:29 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2015-09-17 15:29 UTC (permalink / raw)
  To: Xunlei Pang; +Cc: linux-kernel, Lai Jiangshan, Xunlei Pang

Hello,

On Thu, Sep 17, 2015 at 10:43:55AM +0800, Xunlei Pang wrote:
> From: Xunlei Pang <pang.xunlei@zte.com.cn>
> 
> 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 <pang.xunlei@zte.com.cn>
> ---
>  kernel/workqueue.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index ca71582..22d7747 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -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.

-- 
tejun

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-17 15:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-17  2:43 [PATCH] workqueue: Free useless memory when disabling NUMA in wq_numa_init() Xunlei Pang
2015-09-17 15:29 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).