From: Linus Torvalds <torvalds@linux-foundation.org>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>,
Pekka Enberg <penberg@cs.helsinki.fi>,
linux-kernel <linux-kernel@vger.kernel.org>,
"Rafael J. Wysocki" <rjw@sisk.pl>,
Sachin Sant <sachinp@in.ibm.com>
Subject: Re: [PATCH] mm/init: cpu_hotplug_init() must be initialized before SLAB
Date: Mon, 22 Jun 2009 19:29:18 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.2.01.0906221927280.3240@localhost.localdomain> (raw)
In-Reply-To: <1245717089.4017.18.camel@pasglop>
On Tue, 23 Jun 2009, Benjamin Herrenschmidt wrote:
> + /*
> + * This initializes the mutex used by get/put_online_cpus()
> + * which is used by SLAB
> + */
> + cpu_hotplug_init();
Oh fudge it.
Why not get rid of that stupid thing, rather than have that subtle
dependency and a comment for it.
IOW, does this simpler alternative also work?
When given the choice of simplifying and removing code, always do so.
Static initializers are much nicer than having to worry about when
something gets initialized, no?
Linus
---
include/linux/cpu.h | 5 -----
init/main.c | 1 -
kernel/cpu.c | 13 +++++--------
3 files changed, 5 insertions(+), 14 deletions(-)
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 2643d84..4d668e0 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -69,7 +69,6 @@ static inline void unregister_cpu_notifier(struct notifier_block *nb)
int cpu_up(unsigned int cpu);
void notify_cpu_starting(unsigned int cpu);
-extern void cpu_hotplug_init(void);
extern void cpu_maps_update_begin(void);
extern void cpu_maps_update_done(void);
@@ -84,10 +83,6 @@ static inline void unregister_cpu_notifier(struct notifier_block *nb)
{
}
-static inline void cpu_hotplug_init(void)
-{
-}
-
static inline void cpu_maps_update_begin(void)
{
}
diff --git a/init/main.c b/init/main.c
index 09131ec..4870dfe 100644
--- a/init/main.c
+++ b/init/main.c
@@ -678,7 +678,6 @@ asmlinkage void __init start_kernel(void)
#endif
page_cgroup_init();
enable_debug_pagealloc();
- cpu_hotplug_init();
kmemtrace_init();
kmemleak_init();
debug_objects_mem_init();
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 395b697..8ce1004 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -34,14 +34,11 @@ static struct {
* an ongoing cpu hotplug operation.
*/
int refcount;
-} cpu_hotplug;
-
-void __init cpu_hotplug_init(void)
-{
- cpu_hotplug.active_writer = NULL;
- mutex_init(&cpu_hotplug.lock);
- cpu_hotplug.refcount = 0;
-}
+} cpu_hotplug = {
+ .active_writer = NULL,
+ .lock = __MUTEX_INITIALIZER(cpu_hotplug.lock),
+ .refcount = 0,
+};
#ifdef CONFIG_HOTPLUG_CPU
next prev parent reply other threads:[~2009-06-23 2:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-23 0:31 Benjamin Herrenschmidt
2009-06-23 1:13 ` James Bottomley
2009-06-23 2:29 ` Linus Torvalds [this message]
2009-06-23 2:59 ` Benjamin Herrenschmidt
2009-06-23 3:23 ` Benjamin Herrenschmidt
2009-06-23 3:26 ` Sachin Sant
2009-06-23 4:00 ` James Bottomley
2009-06-23 5:59 ` Pekka Enberg
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=alpine.LFD.2.01.0906221927280.3240@localhost.localdomain \
--to=torvalds@linux-foundation.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=penberg@cs.helsinki.fi \
--cc=rjw@sisk.pl \
--cc=sachinp@in.ibm.com \
/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®