From: Oleg Nesterov <oleg@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched: RCU-protect __set_task_cpu() in set_task_cpu()
Date: Sun, 5 Jun 2011 21:12:33 +0200 [thread overview]
Message-ID: <20110605191233.GA20462@redhat.com> (raw)
In-Reply-To: <1307115427.2353.3456.camel@twins>
On 06/03, Peter Zijlstra wrote:
>
> @@ -2200,6 +2201,16 @@ void set_task_cpu(struct task_struct *p,
> !(task_thread_info(p)->preempt_count & PREEMPT_ACTIVE));
>
> #ifdef CONFIG_LOCKDEP
> + /*
> + * The caller should hold either p->pi_lock or rq->lock, when changing
> + * a task's CPU.
Is it literally true? IIRC, we need ->pi_lock if the task is not active,
and rq->lock if p->on_rq = 1. And that is why we do not clear p->on_rq
between deactivate_task() + activate_task(), correct?
> + *
> + * sched_move_task() holds both and thus holding either pins the cgroup,
> + * see set_task_rq().
> + *
> + * Furthermore, all task_rq users should acquire both locks, see
> + * task_rq_lock().
> + */
> WARN_ON_ONCE(debug_locks && !(lockdep_is_held(&p->pi_lock) ||
> lockdep_is_held(&task_rq(p)->lock)));
IOW, perhaps this should be
WARN_ON_ONCE(debug_locks && !lockdep_is_held(p->on_rq ?
&task_rq(p)->lock : &p->pi_lock))
?
Not that I really suggest to change this WARN_ON(), I am just trying
to recall the new rules.
Oleg.
next prev parent reply other threads:[~2011-06-05 19:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-31 17:26 [PATCH] sched: RCU-protect __set_task_cpu() in set_task_cpu() Sergey Senozhatsky
2011-05-31 19:45 ` Peter Zijlstra
2011-06-03 15:37 ` Peter Zijlstra
2011-06-03 18:16 ` Sergey Senozhatsky
2011-06-03 22:49 ` Sergey Senozhatsky
2011-06-05 19:12 ` Oleg Nesterov [this message]
2011-06-06 9:06 ` Peter Zijlstra
2011-06-06 16:46 ` Oleg Nesterov
2011-06-07 9:31 ` Peter Zijlstra
2011-06-07 14:03 ` Oleg Nesterov
2011-06-06 13:43 ` Peter Zijlstra
2011-06-07 12:03 ` [tip:sched/urgent] sched: Fix/clarify set_task_cpu() locking rules tip-bot for Peter Zijlstra
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=20110605191233.GA20462@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=sergey.senozhatsky@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.