public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] sched: Move the sleeping while atomic checks early in cond_resched()
Date: Fri, 10 Jul 2009 17:12:08 +0200	[thread overview]
Message-ID: <1247238728.7529.46.camel@twins> (raw)
In-Reply-To: <20090710150827.GA5318@nowhere>

On Fri, 2009-07-10 at 17:08 +0200, Frederic Weisbecker wrote:
> On Fri, Jul 10, 2009 at 04:59:55PM +0200, Peter Zijlstra wrote:
> > On Fri, 2009-07-10 at 16:49 +0200, Frederic Weisbecker wrote:
> > 
> > > index 0cb0d8d..e357dc7 100644
> > > --- a/include/linux/sched.h
> > > +++ b/include/linux/sched.h
> > > @@ -2279,11 +2279,13 @@ extern int _cond_resched(void);
> > >  #ifdef CONFIG_PREEMPT_BKL
> > >  static inline int cond_resched(void)
> > >  {
> > > +	might_sleep();
> > >  	return 0;
> > >  }
> > >  #else
> > >  static inline int cond_resched(void)
> > >  {
> > > +	might_sleep();
> > >  	return _cond_resched();
> > >  }
> > >  #endif
> > 
> > # define might_resched() _cond_resched()
> 
> 
> Argh, indeed.
> I thought might_sleep() only wrapped __might_sleep(__FILE__, __LINE__)
> 
>  
> > # define might_sleep() \
> > 	do { __might_sleep(__FILE__, __LINE__); might_resched(); } while (0)
> > 
> > 
> > Doesn't seem to make it any better that, but yeah, moving that
> > __might_sleep() did occur to me earlier today when I touched that code.
> 
> 
> Ok.
> 
> Another idea: if cond_resched() was a macro and __might_sleep() was
> called inside, the given __FILE__ __LINE__ would be much more useful.
> 
> Only the backtraces would be useful in the current state, __FILE__
> and __LINE__ point to sched.h, which is not exactly what is needed,
> right?

Right. There's some CONFIG_PREEMPT_BKL clutter in sched.h but I think we
could largely fold might_sleep() and cond_resched().

Ingo?


  reply	other threads:[~2009-07-10 15:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-10 14:49 [PATCH 1/2] sched: Drop the need_resched() loop from cond_resched() Frederic Weisbecker
2009-07-10 14:49 ` [PATCH 2/2] sched: Move the sleeping while atomic checks early in cond_resched() Frederic Weisbecker
2009-07-10 14:59   ` Peter Zijlstra
2009-07-10 15:08     ` Frederic Weisbecker
2009-07-10 15:12       ` Peter Zijlstra [this message]
2009-07-10 16:10         ` Ingo Molnar
2009-07-10 17:14           ` [PATCH] " Frederic Weisbecker
2009-07-10 17:43             ` Peter Zijlstra
2009-07-10 18:08               ` Frederic Weisbecker
2009-07-10 18:13                 ` Peter Zijlstra
2009-07-10 18:29                   ` Frederic Weisbecker
2009-07-10 15:00 ` [PATCH 1/2] sched: Drop the need_resched() loop from cond_resched() Peter Zijlstra
2009-07-10 15:17 ` Arnd Bergmann
2009-07-10 15:24   ` Frederic Weisbecker
2009-07-10 15:35     ` Arnd Bergmann
2009-07-10 15:50       ` Frederic Weisbecker
2009-07-10 16:11         ` Ingo Molnar
2009-07-10 16:26           ` Frederic Weisbecker
2009-07-10 17:23           ` [PATCH] sched: Remove obsolete comment in __cond_resched() Frederic Weisbecker

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=1247238728.7529.46.camel@twins \
    --to=a.p.zijlstra@chello.nl \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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