linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xiaotian Feng <dfeng@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Xiaotian Feng <dfeng@redhat.com>, Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <peterz@infradead.org>
Subject: [PATCH -tip] sched: more sched_domain iterations fix
Date: Thu, 21 Apr 2011 19:07:24 +0800	[thread overview]
Message-ID: <1303384044-7646-1-git-send-email-dfeng@redhat.com> (raw)

sched_domain iterations needs to be protected by rcu_read_lock() now,
this patch adds another two places which needs the rcu lock.

Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
---
 kernel/sched_rt.c    |    2 ++
 kernel/sched_stats.h |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 19ecb31..901ed2a 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -1282,7 +1282,9 @@ static struct rq *find_lock_lowest_rq(struct task_struct *task, struct rq *rq)
 	int cpu;
 
 	for (tries = 0; tries < RT_MAX_TRIES; tries++) {
+		rcu_read_lock();
 		cpu = find_lowest_rq(task);
+		rcu_read_unlock();
 
 		if ((cpu == -1) || (cpu == rq->cpu))
 			break;
diff --git a/kernel/sched_stats.h b/kernel/sched_stats.h
index 48ddf43..d25c8c1 100644
--- a/kernel/sched_stats.h
+++ b/kernel/sched_stats.h
@@ -38,6 +38,7 @@ static int show_schedstat(struct seq_file *seq, void *v)
 #ifdef CONFIG_SMP
 		/* domain-specific stats */
 		preempt_disable();
+		rcu_read_lock();
 		for_each_domain(cpu, sd) {
 			enum cpu_idle_type itype;
 
@@ -64,6 +65,7 @@ static int show_schedstat(struct seq_file *seq, void *v)
 			    sd->ttwu_wake_remote, sd->ttwu_move_affine,
 			    sd->ttwu_move_balance);
 		}
+		rcu_read_unlock();
 		preempt_enable();
 #endif
 	}
-- 
1.7.1


             reply	other threads:[~2011-04-21 11:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-21 11:07 Xiaotian Feng [this message]
2011-04-21 11:21 ` [PATCH -tip] sched: more sched_domain iterations fix Peter Zijlstra
2011-04-22 10:53   ` [PATCH -tip v2] " Xiaotian feng
2011-04-26  9:27     ` Peter Zijlstra
2011-04-26 10:40       ` Xiaotian Feng
2011-05-28 16:34     ` [tip:sched/urgent] sched: More sched_domain iterations fixes tip-bot for Xiaotian Feng

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=1303384044-7646-1-git-send-email-dfeng@redhat.com \
    --to=dfeng@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.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;
as well as URLs for NNTP newsgroup(s).