lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090710162620.GD5318@nowhere>
Date:	Fri, 10 Jul 2009 18:26:21 +0200
From:	Frederic Weisbecker <fweisbec@...il.com>
To:	Ingo Molnar <mingo@...e.hu>
Cc:	Arnd Bergmann <arnd@...db.de>, LKML <linux-kernel@...r.kernel.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH 1/2] sched: Drop the need_resched() loop from
	cond_resched()

On Fri, Jul 10, 2009 at 06:11:41PM +0200, Ingo Molnar wrote:
> 
> * Frederic Weisbecker <fweisbec@...il.com> wrote:
> 
> > On Fri, Jul 10, 2009 at 05:35:29PM +0200, Arnd Bergmann wrote:
> > > On Friday 10 July 2009, Frederic Weisbecker wrote:
> > > > On Fri, Jul 10, 2009 at 05:17:38PM +0200, Arnd Bergmann wrote:
> > > > > On Friday 10 July 2009, Frederic Weisbecker wrote:
> > > > > > --- a/kernel/sched.c
> > > > > > +++ b/kernel/sched.c
> > > > > > @@ -6613,11 +6613,9 @@ static void __cond_resched(void)
> > > > > >          * PREEMPT_ACTIVE, which could trigger a second
> > > > > >          * cond_resched() call.
> > > > > >          */
> > > > > > -       do {
> > > > > > -               add_preempt_count(PREEMPT_ACTIVE);
> > > > > > -               schedule();
> > > > > > -               sub_preempt_count(PREEMPT_ACTIVE);
> > > > > > -       } while (need_resched());
> > > > > > +       add_preempt_count(PREEMPT_ACTIVE);
> > > > > > +       schedule();
> > > > > > +       sub_preempt_count(PREEMPT_ACTIVE);
> > > > > >  }
> > > > > >  
> > > > > 
> > > > > If you drop the loop, then you should also remove the comment that
> > > > > explains why it was put there.
> > > > > 
> > > > 
> > > > Hmm, these comments seem to actually explain why we do the PREEMPT_ACTIVE
> > > > trick, which is to prevent from cond_resched() recursion, right?
> > > > 
> > > 
> > > I think we both misinterpreted the comment, which seemed to refer
> > > to older code added by Ingo in 5bbcfd900 "cond_resched(): fix bogus
> > > might_sleep() warning" and removed by Andrew in e7b384043e2
> > > "cond_resched() fix".
> > > 
> > > The original code in Ingos version looked like
> > > 
> > >  static inline void __cond_resched(void)
> > >  {
> > >        /*
> > >         * The BKS might be reacquired before we have dropped
> > >         * PREEMPT_ACTIVE, which could trigger a second
> > >         * cond_resched() call.
> > >         */
> > >        if (unlikely(preempt_count()))
> > >                return;
> > >        do {
> > >                add_preempt_count(PREEMPT_ACTIVE);
> > >                schedule();
> > > 	...
> > > 
> > > 
> > > So, it's got nothing to do with the loop, but should still be removed
> > > because the 'if (unlikely(preempt_count()))' is no longer there.
> > 
> > 
> > Yeah, but the comment still fits the code after this patch, don't 
> > you think? :-)
> 
> ... except that there's no Big Kernel Semaphore anymore ;-)
> 
> 	Ingo

Ah, I lack some backgrounds about Linux heroic ages :)
I thought it was a mispell of BKL.

I guess the comment should be removed anyway, while reading it
more, it doesn't explain the code that follows it.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ