public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Mike Galbraith <umgwanakikbuti@gmail.com>
Cc: peterz@infradead.org, mingo@elte.hu, josh@joshtriplett.org,
	laijs@cn.fujitsu.com, linux-kernel@vger.kernel.org
Subject: Re: cond_resched() and RCU CPU stall warnings
Date: Sat, 15 Mar 2014 23:27:43 -0700	[thread overview]
Message-ID: <20140316062743.GY21124@linux.vnet.ibm.com> (raw)
In-Reply-To: <1394950455.5470.16.camel@marge.simpson.net>

On Sun, Mar 16, 2014 at 07:14:15AM +0100, Mike Galbraith wrote:
> On Sun, 2014-03-16 at 07:09 +0100, Mike Galbraith wrote: 
> > On Sat, 2014-03-15 at 18:59 -0700, Paul E. McKenney wrote: 
> 
> > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > > index b46131ef6aab..994d2b0fd0b2 100644
> > > --- a/kernel/sched/core.c
> > > +++ b/kernel/sched/core.c
> > > @@ -4075,6 +4075,9 @@ int __sched _cond_resched(void)
> > >  		__cond_resched();
> > >  		return 1;
> > >  	}
> > > +	preempt_disable();
> > > +	rcu_note_context_switch(smp_processor_id());
> > > +	preempt_enable();
> > >  	return 0;
> > >  }
> > >  EXPORT_SYMBOL(_cond_resched);
> > 
> > Hm.  Since you only care about the case where your task is solo, how
> > about do racy checks, 100% accuracy isn't required is it?  Seems you
> > wouldn't want to unconditionally do that in tight loops.
> 
> (or do that in scheduler_tick()?)

There are checks in scheduler_tick(), but they have to assume that
if they interrupt kernel execution, they might have also interrupted
an RCU read-side critical section.  And in fact, the point of having
cond_resched() (sometimes) do a quiescent state is to communicate with
the existing checks invoked from scheduler_tick().

							Thanx, Paul


  reply	other threads:[~2014-03-16  6:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-16  1:59 cond_resched() and RCU CPU stall warnings Paul E. McKenney
2014-03-16  6:09 ` Mike Galbraith
2014-03-16  6:14   ` Mike Galbraith
2014-03-16  6:27     ` Paul E. McKenney [this message]
2014-03-16  6:25   ` Paul E. McKenney
2014-03-16  7:30     ` Mike Galbraith
2014-03-17 10:13 ` Peter Zijlstra
2014-03-17 16:58   ` Paul E. McKenney
2014-03-17 17:14     ` Peter Zijlstra
2014-03-18  2:17       ` Paul E. McKenney
2014-03-18  8:51         ` Peter Zijlstra
2014-03-18 12:49           ` Paul E. McKenney
2014-03-18 13:45             ` Peter Zijlstra
2014-03-18 15:15               ` 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=20140316062743.GY21124@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=josh@joshtriplett.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox