lkml.org 
[lkml]   [2009]   [Jul]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] sched: Move the sleeping while atomic checks early in cond_resched()

* Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:

> 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?

Yep - CONFIG_PREEMPT_BKL wont ever come back so any legacy related
to it should be removed. (That doesnt mean it wont crash or
misbehave, this code is quite fragile.)

Ingo


\
 
 \ /
  Last update: 2009-07-10 18:13    [from the cache]
©2003-2011 Jasper Spaans