All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Patel, Vedang" <vedang.patel@intel.com>
To: "juri.lelli@gmail.com" <juri.lelli@gmail.com>,
	"peterz@infradead.org" <peterz@infradead.org>
Cc: "linux-rt-users@vger.kernel.org" <linux-rt-users@vger.kernel.org>,
	"Koppolu, Chanakya" <chanakya.koppolu@intel.com>
Subject: Re: yielding while running SCHED_DEADLINE
Date: Mon, 17 Sep 2018 17:14:20 +0000	[thread overview]
Message-ID: <1537204460.3250.4.camel@intel.com> (raw)
In-Reply-To: <20180917114219.GE24106@hirez.programming.kicks-ass.net>

On Mon, 2018-09-17 at 13:42 +0200, Peter Zijlstra wrote:
> On Mon, Sep 17, 2018 at 11:26:48AM +0200, Juri Lelli wrote:
> > 
> > Hi,
> > 
> > On 14/09/18 23:13, Patel, Vedang wrote:
> > > 
> > > Hi all, 
> > > 
> > > We have been playing around with SCHED_DEADLINE and found some
> > > discrepancy around the calculation of nr_involuntary_switches and
> > > nr_voluntary_switches in /proc/${PID}/sched.
> > > 
> > > Whenever the task is done with it's work earlier and executes
> > > sched_yield() to voluntarily gives up the CPU this increments
> > > nr_involuntary_switches. It should have incremented
> > > nr_voluntary_switches.
> > Mmm, I see what you are saying.
> > 
> > [...]
> > 
> > > 
> > > Looking at __schedule() in kernel/sched/core.c, the switch is
> > > counted
> > > as part of nr_involuntary_switches if the task has not been
> > > preempted
> > > and the task is TASK_RUNNING state. This does not seem to happen
> > > when
> > > sched_yield() is called.
> > Mmm,
> > 
> >  - nr_voluntary_switches++ if !preempt && !RUNNING
> >  - nr_involuntary_switches++ otherwise (yield fits this as the task
> > is
> >    still RUNNING, even though throttled for DEADLINE)
> > 
> > Not sure this is the same as what you say above..
> > 
> > > 
> > > Is there something we are missing over here? OR Is this a known
> > > issue
> > > and is planned to be fixed later?
> > .. however, not sure. Peter, what you say. It looks like we might
> > indeed
> > want to account yield as a voluntary switch, seems to fit. In this
> > case
> > I guess we could use a flag or add a sched_ bit to task_struct to
> > handle
> > the case?
> It's been like this _forever_ afaict. This isn't deadline specific
> afaict, all yield callers will end up in non-voluntary switches.
> 
> I don't know anybody that cares and I don't think this is something
> worth fixing. If someone did rely on this behaviour we'd break them,
> and
> i'd much rather save a cycle than add more stupid stats crap to the
> scheduler.
Thanks Peter and Juri for the response.

We will try to use a different mechanism to account for this.

-Vedang

  reply	other threads:[~2018-09-17 22:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-14 23:13 yielding while running SCHED_DEADLINE Patel, Vedang
2018-09-17  9:26 ` Juri Lelli
2018-09-17 11:42   ` Peter Zijlstra
2018-09-17 17:14     ` Patel, Vedang [this message]
2018-09-21  0:19     ` Bowles, Matthew K

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=1537204460.3250.4.camel@intel.com \
    --to=vedang.patel@intel.com \
    --cc=chanakya.koppolu@intel.com \
    --cc=juri.lelli@gmail.com \
    --cc=linux-rt-users@vger.kernel.org \
    --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 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.