mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Peter Zijlstra <peterz@infradead.org>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	a.p.zijlstra@chello.nl, peterz@infradead.org,
	eparis@parisplace.org, paulmck@linux.vnet.ibm.com,
	tglx@linutronix.de, mingo@elte.hu
Subject: [tip:core/urgent] rcu: Fix RCU lockdep splat in set_task_cpu on fork path
Date: Fri, 30 Apr 2010 10:51:35 GMT	[thread overview]
Message-ID: <tip-8b08ca52f5942c21564bbb90ccfb61053f2c26a1@git.kernel.org> (raw)
In-Reply-To: <1271880131-3951-1-git-send-email-paulmck@linux.vnet.ibm.com>

Commit-ID:  8b08ca52f5942c21564bbb90ccfb61053f2c26a1
Gitweb:     http://git.kernel.org/tip/8b08ca52f5942c21564bbb90ccfb61053f2c26a1
Author:     Peter Zijlstra <peterz@infradead.org>
AuthorDate: Wed, 21 Apr 2010 13:02:07 -0700
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 30 Apr 2010 12:03:17 +0200

rcu: Fix RCU lockdep splat in set_task_cpu on fork path

Add an RCU read-side critical section to suppress this false
positive.

Located-by: Eric Paris <eparis@parisplace.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: laijs@cn.fujitsu.com
Cc: dipankar@in.ibm.com
Cc: mathieu.desnoyers@polymtl.ca
Cc: josh@joshtriplett.org
Cc: dvhltc@us.ibm.com
Cc: niv@us.ibm.com
Cc: peterz@infradead.org
Cc: rostedt@goodmis.org
Cc: Valdis.Kletnieks@vt.edu
Cc: dhowells@redhat.com
Cc: eric.dumazet@gmail.com
LKML-Reference: <1271880131-3951-1-git-send-email-paulmck@linux.vnet.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/sched.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index de0bd26..3c2a54f 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -323,6 +323,15 @@ static inline struct task_group *task_group(struct task_struct *p)
 /* Change a task's cfs_rq and parent entity if it moves across CPUs/groups */
 static inline void set_task_rq(struct task_struct *p, unsigned int cpu)
 {
+	/*
+	 * Strictly speaking this rcu_read_lock() is not needed since the
+	 * task_group is tied to the cgroup, which in turn can never go away
+	 * as long as there are tasks attached to it.
+	 *
+	 * However since task_group() uses task_subsys_state() which is an
+	 * rcu_dereference() user, this quiets CONFIG_PROVE_RCU.
+	 */
+	rcu_read_lock();
 #ifdef CONFIG_FAIR_GROUP_SCHED
 	p->se.cfs_rq = task_group(p)->cfs_rq[cpu];
 	p->se.parent = task_group(p)->se[cpu];
@@ -332,6 +341,7 @@ static inline void set_task_rq(struct task_struct *p, unsigned int cpu)
 	p->rt.rt_rq  = task_group(p)->rt_rq[cpu];
 	p->rt.parent = task_group(p)->rt_se[cpu];
 #endif
+	rcu_read_unlock();
 }
 
 #else

  reply	other threads:[~2010-04-30 16:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-21 20:01 [PATCH tip/core/urgent] fix several lockdep splats, allow multiple splats Paul E. McKenney
2010-04-21 20:02 ` [PATCH tip/core/urgent 1/5] rcu: Fix RCU lockdep splat in set_task_cpu on fork path Paul E. McKenney
2010-04-30 10:51   ` tip-bot for Peter Zijlstra [this message]
2010-04-21 20:02 ` [PATCH tip/core/urgent 2/5] rcu: fix RCU lockdep splat on freezer_fork path Paul E. McKenney
2010-04-30 10:51   ` [tip:core/urgent] rcu: Fix " tip-bot for Paul E. McKenney
2010-04-21 20:02 ` [PATCH tip/core/urgent 3/5] rcu: leave lockdep enabled after RCU lockdep splat Paul E. McKenney
2010-04-21 20:02 ` [PATCH tip/core/urgent 4/5] NFSv4: Fix the locking in nfs_inode_reclaim_delegation() Paul E. McKenney
2010-04-21 20:02 ` [PATCH tip/core/urgent 5/5] NFS: Fix RCU issues in the NFSv4 delegation code Paul E. McKenney
2010-04-30 10:07 ` [PATCH tip/core/urgent] fix several lockdep splats, allow multiple splats Ingo Molnar
2010-04-30 15:33   ` Mathieu Desnoyers
2010-04-30 16:16     ` Valdis.Kletnieks
2010-04-30 18:02       ` Paul E. McKenney
2010-04-30 18:12         ` Mathieu Desnoyers
2010-04-30 18:32           ` Paul E. McKenney
2010-04-30 19:09             ` Mathieu Desnoyers
2010-04-30 23:47   ` Paul E. McKenney

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-8b08ca52f5942c21564bbb90ccfb61053f2c26a1@git.kernel.org \
    --to=peterz@infradead.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=eparis@parisplace.org \
    --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=paulmck@linux.vnet.ibm.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

Powered by JetHome