linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xunlei Pang <xlpang@126.com>
To: linux-kernel@vger.kernel.org, Tejun Heo <tj@kernel.org>,
	Lai Jiangshan <jiangshanlai@gmail.com>
Cc: Xunlei Pang <pang.xunlei@zte.com.cn>
Subject: [PATCH] workqueue: Free useless memory when disabling NUMA in wq_numa_init()
Date: Thu, 17 Sep 2015 10:43:55 +0800	[thread overview]
Message-ID: <1442457835-24238-1-git-send-email-xlpang@126.com> (raw)

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



             reply	other threads:[~2015-09-17  2:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-17  2:43 Xunlei Pang [this message]
2015-09-17 15:29 ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1442457835-24238-1-git-send-email-xlpang@126.com \
    --to=xlpang@126.com \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pang.xunlei@zte.com.cn \
    --cc=tj@kernel.org \
    --subject='Re: [PATCH] workqueue: Free useless memory when disabling NUMA in wq_numa_init()' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).