From: Paul Mackerras <paulus@samba.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>, linux-kernel@vger.kernel.org
Subject: [PATCH] perf_counter: Initialize per-cpu context earlier on cpu up
Date: Tue, 2 Jun 2009 21:05:16 +1000 [thread overview]
Message-ID: <18981.1900.792795.836858@cargo.ozlabs.ibm.com> (raw)
This arranges for perf_counter's notifier for cpu hotplug operations
to be called earlier than the migration notifier in sched.c by
increasing its priority to 20, compared to the 10 for the migration
notifier. The reason for doing this is that a subsequent commit to
convert the cpu migration counter to use the generic swcounter
infrastructure will add a call into the perf_counter subsystem when
tasks get migrated. Therefore the perf_counter subsystem needs a
chance to initialize its per-cpu data for the new cpu before it can
get called from the migration code.
This also adds a comment to the migration notifier noting that its
priority needs to be lower than that of the perf_counter notifier.
Signed-off-by: Paul Mackerras <paulus@samba.org>
---
kernel/perf_counter.c | 4 ++++
kernel/sched.c | 6 ++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index df319c4..8d2653f 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -3902,8 +3902,12 @@ perf_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu)
return NOTIFY_OK;
}
+/*
+ * This has to have a higher priority than migration_notifier in sched.c.
+ */
static struct notifier_block __cpuinitdata perf_cpu_nb = {
.notifier_call = perf_cpu_notify,
+ .priority = 20,
};
void __init perf_counter_init(void)
diff --git a/kernel/sched.c b/kernel/sched.c
index ad079f0..3226cc1 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -7319,8 +7319,10 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu)
return NOTIFY_OK;
}
-/* Register at highest priority so that task migration (migrate_all_tasks)
- * happens before everything else.
+/*
+ * Register at high priority so that task migration (migrate_all_tasks)
+ * happens before everything else. This has to be lower priority than
+ * the notifier in the perf_counter subsystem, though.
*/
static struct notifier_block __cpuinitdata migration_notifier = {
.notifier_call = migration_call,
--
1.6.0.4
next reply other threads:[~2009-06-02 11:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-02 11:05 Paul Mackerras [this message]
2009-06-02 14:18 ` [tip:perfcounters/core] " tip-bot for Paul Mackerras
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=18981.1900.792795.836858@cargo.ozlabs.ibm.com \
--to=paulus@samba.org \
--cc=a.p.zijlstra@chello.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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®