lkml.org 
[lkml]   [2012]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 6/6] workqueue: use hotcpu_notifier() for workqueue_cpu_down_callback()
Date
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 e8d3c95..fc4208a 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -3791,7 +3791,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


\
 
 \ /
  Last update: 2012-09-15 11:21    [W:1.049 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site