Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1270089

Re: [PATCH v4 3/3] sched: optimize migration by forcing rmb() and updating to be called once

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH v4 3/3] sched: optimize migration by forcing rmb() and updating to be called once
Date 2015-11-16 14:00 +0100
Message-ID <qvry2-7qr-17@gated-at.bofh.it> (permalink)
References (1 earlier) <qmNeq-6xZ-29@gated-at.bofh.it> <qsUGe-6X1-13@gated-at.bofh.it> <qt5Lk-6GX-3@gated-at.bofh.it> <qtg41-4WH-1@gated-at.bofh.it> <qtqZr-3pr-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Nov 11, 2015 at 08:51:47AM +0900, Byungchul Park wrote:
> On Tue, Nov 10, 2015 at 01:16:47PM +0100, Peter Zijlstra wrote:
> > So the problem is that as soon as that ->cpu store comes through, the
> > other rq->lock can happen, even though we might still hold a rq->lock
> > thinking we're serialized.
> > 
> > Take for instance move_queued_tasks(), it does:
> > 
> > 	dequeue_task(rq, p, 0);
> > 	p->on_rq = TASK_ON_RQ_MIGRATING;
> > 	set_task_cpu(p, new_cpu) {
> > 	  __set_task_cpu();
> > 
> > ^^^ here holding rq->lock is insufficient and the below:
> > 
> > 	  p->sched_class->migrate_task_rq()
> 
> Thank you for explaning in detail, but this's why i asked you.

> Yes, rq->lock is insufficient in this place as you said, but
> should migrate_task_rq() be serialized by rq->lock? I might have
> agreed with you if the migrate_task_rq() should be serialized by
> rq->lock, but I think it's not the case. I think it would be of
> if task->pi_lock can work correcly within *if statement* in 
> set_task_cpu(). Wrong?

So currently, set_task_cpu() is serialized by:

 - p->pi_lock; on wakeup
 - rq->lock; otherwise

(see the #ifdef CONFIG_LOCKDEP comment in set_task_cpu())

This means that sched_class::migrate_task() cannot indeed rely on
rq->lock for full serialization, however it still means that
task_rq_lock() will fully serialize against the thing.

By changing this, it no longer will.

Even without that; I think such a change, if correct, is very fragile
and prone to creating problems later on, and sets bad precedent.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v4 3/3] sched: optimize migration by forcing rmb() and  updating to be called once Peter Zijlstra <peterz@infradead.org> - 2015-11-09 14:30 +0100
  Re: [PATCH v4 3/3] sched: optimize migration by forcing rmb() and  updating to be called once Byungchul Park <byungchul.park@lge.com> - 2015-11-10 02:20 +0100
    Re: [PATCH v4 3/3] sched: optimize migration by forcing rmb() and  updating to be called once Peter Zijlstra <peterz@infradead.org> - 2015-11-10 13:20 +0100
      Re: [PATCH v4 3/3] sched: optimize migration by forcing rmb() and  updating to be called once Byungchul Park <byungchul.park@lge.com> - 2015-11-11 01:00 +0100
        Re: [PATCH v4 3/3] sched: optimize migration by forcing rmb() and  updating to be called once Byungchul Park <byungchul.park@lge.com> - 2015-11-11 11:20 +0100
        Re: [PATCH v4 3/3] sched: optimize migration by forcing rmb() and  updating to be called once Peter Zijlstra <peterz@infradead.org> - 2015-11-16 14:00 +0100
          Re: [PATCH v4 3/3] sched: optimize migration by forcing rmb() and  updating to be called once Byungchul Park <byungchul.park@lge.com> - 2015-11-17 01:50 +0100
            Re: [PATCH v4 3/3] sched: optimize migration by forcing rmb() and  updating to be called once Peter Zijlstra <peterz@infradead.org> - 2015-11-17 12:30 +0100
              Re: [PATCH v4 3/3] sched: optimize migration by forcing rmb() and  updating to be called once Byungchul Park <byungchul.park@lge.com> - 2015-11-18 00:40 +0100
                Re: [PATCH v4 3/3] sched: optimize migration by forcing rmb() and  updating to be called once Peter Zijlstra <peterz@infradead.org> - 2015-11-18 01:00 +0100
                Re: [PATCH v4 3/3] sched: optimize migration by forcing rmb() and  updating to be called once Byungchul Park <byungchul.park@lge.com> - 2015-11-18 01:10 +0100

csiph-web