From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: Tejun Heo <tj@kernel.org>, linux-kernel@vger.kernel.org
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Subject: [V2 for-next PATCH 7/7] workqueue: use hotcpu_notifier() for workqueue_cpu_down_callback()
Date: Mon, 17 Sep 2012 23:46:48 +0800 [thread overview]
Message-ID: <1347896808-2398-8-git-send-email-laijs@cn.fujitsu.com> (raw)
In-Reply-To: <1347896808-2398-1-git-send-email-laijs@cn.fujitsu.com>
workqueue_cpu_down_callback() is only used when HOTPLUG_CPU=y.
so it will be better if we use hotcpu_notifier() to register it.
When HOTPLUG_CPU=y, hotcpu_notifier() and cpu_notifier() are the same.
When HOTPLUG_CPU=n, if we use cpu_notifier(), workqueue_cpu_down_callback()
will be called(no-op) when booting and the memory of workqueue_cpu_down_callback()
and gcwq_unbind_fn() will be discard after boot.
But if we use hotcpu_notifier(), we can avoid the no-op calls of
workqueue_cpu_down_callback(). And the memory of workqueue_cpu_down_callback()
and gcwq_unbind_fn() will be discard at build time:
$ ls -l kernel/workqueue.o.cpu_notifier kernel/workqueue.o.hotcpu_notifier
-rw-rw-r-- 1 laijs laijs 484080 Sep 15 11:31 kernel/workqueue.o.cpu_notifier
-rw-rw-r-- 1 laijs laijs 478240 Sep 15 11:31 kernel/workqueue.o.hotcpu_notifier
$ size kernel/workqueue.o.cpu_notifier kernel/workqueue.o.hotcpu_notifier
text data bss dec hex filename
18513 2387 1221 22121 5669 kernel/workqueue.o.cpu_notifier
18082 2355 1221 21658 549a kernel/workqueue.o.hotcpu_notifier
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
kernel/workqueue.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 2adb316..ba2dbaa 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -3815,7 +3815,7 @@ static int __init init_workqueues(void)
WORK_CPU_LAST);
cpu_notifier(workqueue_cpu_up_callback, CPU_PRI_WORKQUEUE_UP);
- cpu_notifier(workqueue_cpu_down_callback, CPU_PRI_WORKQUEUE_DOWN);
+ hotcpu_notifier(workqueue_cpu_down_callback, CPU_PRI_WORKQUEUE_DOWN);
/* initialize gcwqs */
for_each_gcwq_cpu(cpu) {
--
1.7.4.4
next prev parent reply other threads:[~2012-09-17 15:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-17 15:46 [V2 for-next PATCH 0/7] workqueue: async idle rebinding and cleanup for hotplug Lai Jiangshan
2012-09-17 15:46 ` [V2 for-3.6-fixes PATCH 1/7] workqueue: clear WORKER_REBIND unconditionaly in busy_worker_rebind_fn() Lai Jiangshan
2012-09-17 15:46 ` [V2 for-next PATCH 2/7] workqueue: async idle rebinding Lai Jiangshan
2012-09-17 15:46 ` [V2 for-next PATCH 3/7] workqueue: new day don't need WORKER_REBIND for busy rebinding Lai Jiangshan
2012-09-17 15:46 ` [V2 for-next PATCH 4/7] workqueue: remove WORKER_REBIND Lai Jiangshan
2012-09-17 15:46 ` [V2 for-next PATCH 5/7] workqueue: rename manager_mutex to assoc_mutex Lai Jiangshan
2012-09-17 15:46 ` [V2 for-next PATCH 6/7] workqueue: use __cpuinit instead of __devinit for cpu callback Lai Jiangshan
2012-09-17 15:46 ` Lai Jiangshan [this message]
2012-09-18 9:40 ` [V2 for-next PATCH 0/7] workqueue: async idle rebinding and cleanup for hotplug Lai Jiangshan
2012-09-18 17:03 ` 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=1347896808-2398-8-git-send-email-laijs@cn.fujitsu.com \
--to=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®