Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1226634 > unrolled thread

[PATCH] workqueue: Free useless memory when disabling NUMA in wq_numa_init()

Started byXunlei Pang <xlpang@126.com>
First post2015-09-17 04:50 +0200
Last post2015-09-17 17:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] workqueue: Free useless memory when disabling NUMA in wq_numa_init() Xunlei Pang <xlpang@126.com> - 2015-09-17 04:50 +0200
    Re: [PATCH] workqueue: Free useless memory when disabling NUMA in  wq_numa_init() Tejun Heo <tj@kernel.org> - 2015-09-17 17:40 +0200

#1226634 — [PATCH] workqueue: Free useless memory when disabling NUMA in wq_numa_init()

FromXunlei Pang <xlpang@126.com>
Date2015-09-17 04:50 +0200
Subject[PATCH] workqueue: Free useless memory when disabling NUMA in wq_numa_init()
Message-ID<q9xqN-6Pu-1@gated-at.bofh.it>
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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1227139 — Re: [PATCH] workqueue: Free useless memory when disabling NUMA in wq_numa_init()

FromTejun Heo <tj@kernel.org>
Date2015-09-17 17:40 +0200
SubjectRe: [PATCH] workqueue: Free useless memory when disabling NUMA in wq_numa_init()
Message-ID<q9Js0-7OO-73@gated-at.bofh.it>
In reply to#1226634
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web