All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kirill Tkhai <ktkhai@parallels.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Kirill Tkhai <tkhai@yandex.ru>, <linux-kernel@vger.kernel.org>,
	<nicolas.pitre@linaro.org>, <pjt@google.com>, <oleg@redhat.com>,
	<rostedt@goodmis.org>, <umgwanakikbuti@gmail.com>,
	<tim.c.chen@linux.intel.com>, <mingo@kernel.org>
Subject: Re: [PATCH v2 2/5] sched: Teach scheduler to understand ONRQ_MIGRATING state
Date: Mon, 28 Jul 2014 13:05:38 +0400	[thread overview]
Message-ID: <1406538338.23175.12.camel@tkhai> (raw)
In-Reply-To: <20140728080122.GL6758@twins.programming.kicks-ass.net>

В Пн, 28/07/2014 в 10:01 +0200, Peter Zijlstra пишет:
> On Sat, Jul 26, 2014 at 06:59:21PM +0400, Kirill Tkhai wrote:
> 
> > The profit is that double_rq_lock() is not needed now,
> > and this may reduce the latencies in some situations.
> 
> > We add a loop in the beginning of set_cpus_allowed_ptr.
> > It's like a handmade spinlock, which is similar
> > to situation we had before. We used to spin on rq->lock,
> > now we spin on "again:" label. Of course, it's worse
> > than arch-dependent spinlock, but we have to have it
> > here. 
> 
> > @@ -4623,8 +4639,16 @@ int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask)
> >  	struct rq *rq;
> >  	unsigned int dest_cpu;
> >  	int ret = 0;
> > +again:
> > +	while (unlikely(task_migrating(p)))
> > +		cpu_relax();
> >  
> >  	rq = task_rq_lock(p, &flags);
> > +	/* Check again with rq locked */
> > +	if (unlikely(task_migrating(p))) {
> > +		task_rq_unlock(rq, p, &flags);
> > +		goto again;
> > +	}
> >  
> >  	if (cpumask_equal(&p->cpus_allowed, new_mask))
> >  		goto out;
> 
> So I really dislike that, esp since you're now talking of adding more of
> this goo all over the place.
> 
> I'll ask again, why isn't this in task_rq_lock() and co?

I thought, this may give a little profit in cases of priority inheritance etc.
But since this is spreading throughout the scheduler, I'm agree with you.
It's better to place this in task_rq_lock() etc. This will decide all
the problems that we have discussed with Oleg.

> Also, you really need to talk the spin bounded, otherwise your two
> quoted paragraphs above are in contradiction. Now I think you can
> actually make an argument that way, so that's good.

Thanks,
Kirill


  reply	other threads:[~2014-07-28  9:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-26 14:58 [PATCH v2 0/5] sched: Add on_rq states and remove several double rq locks Kirill Tkhai
2014-07-26 14:59 ` [PATCH v2 1/5] sched: Wrapper for checking task_struct's .on_rq Kirill Tkhai
2014-07-26 14:59 ` [PATCH v2 2/5] sched: Teach scheduler to understand ONRQ_MIGRATING state Kirill Tkhai
2014-07-28  8:01   ` Peter Zijlstra
2014-07-28  9:05     ` Kirill Tkhai [this message]
2014-07-29  9:53       ` Kirill Tkhai
2014-07-29 12:38         ` Peter Zijlstra
2014-07-29 16:19         ` Oleg Nesterov
2014-07-30  8:04           ` Kirill Tkhai
2014-07-30 14:41             ` Oleg Nesterov
2014-07-30 21:25               ` Kirill Tkhai
2014-07-26 14:59 ` [PATCH v2 3/5] sched: Remove double_rq_lock() from __migrate_task() Kirill Tkhai
2014-07-26 14:59 ` [PATCH v2 4/5] sched/fair: Remove double_lock_balance() from active_load_balance_cpu_stop() Kirill Tkhai
2014-07-26 14:59 ` [PATCH v2 5/5] sched/fair: Remove double_lock_balance() from load_balance() Kirill Tkhai
2014-07-29 12:57   ` Peter Zijlstra
2014-07-26 19:39 ` [PATCH v2 0/5] sched: Add on_rq states and remove several double rq locks Oleg Nesterov
2014-07-27 21:26   ` Kirill Tkhai
2014-07-28 13:19     ` Oleg Nesterov

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=1406538338.23175.12.camel@tkhai \
    --to=ktkhai@parallels.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=nicolas.pitre@linaro.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=rostedt@goodmis.org \
    --cc=tim.c.chen@linux.intel.com \
    --cc=tkhai@yandex.ru \
    --cc=umgwanakikbuti@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.