From: tip-bot for Peter Zijlstra <a.p.zijlstra@chello.nl>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
a.p.zijlstra@chello.nl, tglx@linutronix.de, mingo@elte.hu
Subject: [tip:sched/core] sched: Fix sched_domain iterations vs. RCU
Date: Tue, 19 Apr 2011 12:06:04 GMT [thread overview]
Message-ID: <tip-057f3fadb347e9c51b07e1b277bbdda79f976768@git.kernel.org> (raw)
In-Reply-To: <1302882741.2388.241.camel@twins>
Commit-ID: 057f3fadb347e9c51b07e1b277bbdda79f976768
Gitweb: http://git.kernel.org/tip/057f3fadb347e9c51b07e1b277bbdda79f976768
Author: Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Mon, 18 Apr 2011 11:24:34 +0200
Committer: Ingo Molnar <mingo@elte.hu>
CommitDate: Tue, 19 Apr 2011 10:56:54 +0200
sched: Fix sched_domain iterations vs. RCU
Vladis Kletnieks reported a new RCU debug warning in the scheduler.
Since commit dce840a08702b ("sched: Dynamically allocate sched_domain/
sched_group data-structures") the sched_domain trees are protected by
RCU instead of RCU-sched.
This means that we need to include rcu_read_lock() protection when we
iterate them since disabling preemption doesn't suffice anymore.
Reported-by: Valdis.Kletnieks@vt.edu
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1302882741.2388.241.camel@twins
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
kernel/sched.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/kernel/sched.c b/kernel/sched.c
index 0cfe031..27d3e73 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1208,11 +1208,17 @@ int get_nohz_timer_target(void)
int i;
struct sched_domain *sd;
+ rcu_read_lock();
for_each_domain(cpu, sd) {
- for_each_cpu(i, sched_domain_span(sd))
- if (!idle_cpu(i))
- return i;
+ for_each_cpu(i, sched_domain_span(sd)) {
+ if (!idle_cpu(i)) {
+ cpu = i;
+ goto unlock;
+ }
+ }
}
+unlock:
+ rcu_read_unlock();
return cpu;
}
/*
@@ -2415,12 +2421,14 @@ ttwu_stat(struct task_struct *p, int cpu, int wake_flags)
struct sched_domain *sd;
schedstat_inc(p, se.statistics.nr_wakeups_remote);
+ rcu_read_lock();
for_each_domain(this_cpu, sd) {
if (cpumask_test_cpu(cpu, sched_domain_span(sd))) {
schedstat_inc(sd, ttwu_wake_remote);
break;
}
}
+ rcu_read_unlock();
}
#endif /* CONFIG_SMP */
next prev parent reply other threads:[~2011-04-19 12:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-14 22:08 mmotm 2011-04-14-15-08 uploaded akpm
2011-04-15 14:57 ` mmotm 2011-04-14 - lockdep splats in sched.c during boot Valdis.Kletnieks
2011-04-15 15:52 ` Peter Zijlstra
2011-04-19 12:06 ` tip-bot for Peter Zijlstra [this message]
2011-04-15 18:53 ` mmotm 2011-04-14 - hangs " Valdis.Kletnieks
2011-04-15 19:06 ` Peter Zijlstra
2011-04-15 19:28 ` Valdis.Kletnieks
2011-04-15 19:35 ` Peter Zijlstra
2011-04-15 19:38 ` Valdis.Kletnieks
2011-04-15 15:50 ` mmotm 2011-04-14-15-08 uploaded (leds) Randy Dunlap
2011-04-15 16:12 ` mmotm 2011-04-14-15-08 uploaded (staging/gma500) Randy Dunlap
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=tip-057f3fadb347e9c51b07e1b277bbdda79f976768@git.kernel.org \
--to=a.p.zijlstra@chello.nl \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).