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: <20120906173207.GK2448@linux.vnet.ibm.com>
Date:	Thu, 6 Sep 2012 10:32:07 -0700
From:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	linux-kernel@...r.kernel.org, mingo@...e.hu, laijs@...fujitsu.com,
	dipankar@...ibm.com, akpm@...ux-foundation.org,
	mathieu.desnoyers@...ymtl.ca, josh@...htriplett.org,
	niv@...ibm.com, tglx@...utronix.de, rostedt@...dmis.org,
	Valdis.Kletnieks@...edu, dhowells@...hat.com,
	eric.dumazet@...il.com, darren@...art.com, fweisbec@...il.com,
	sbw@....edu, patches@...aro.org
Subject: Re: [PATCH tip/core/rcu 06/23] rcu: Break up rcu_gp_kthread() into
 subfunctions

On Thu, Sep 06, 2012 at 03:39:51PM +0200, Peter Zijlstra wrote:
> On Thu, 2012-08-30 at 11:18 -0700, Paul E. McKenney wrote:
> > +static int rcu_gp_kthread(void *arg)
> > +{
> > +       struct rcu_state *rsp = arg;
> > +       struct rcu_node *rnp = rcu_get_root(rsp);
> > +
> > +       for (;;) {
> > +
> > +               /* Handle grace-period start. */
> > +               for (;;) {
> > +                       wait_event_interruptible(rsp->gp_wq, rsp->gp_flags);
> > +                       if (rsp->gp_flags && rcu_gp_init(rsp))
> > +                               break;
> > +                       cond_resched();
> > +                       flush_signals(current);
> > +               }
> >  
> >                 /* Handle grace-period end. */
> >                 for (;;) {
> >                         wait_event_interruptible(rsp->gp_wq,
> >                                                  !ACCESS_ONCE(rnp->qsmask) &&
> >                                                  !rcu_preempt_blocked_readers_cgp(rnp));
> >                         if (!ACCESS_ONCE(rnp->qsmask) &&
> > +                           !rcu_preempt_blocked_readers_cgp(rnp) &&
> > +                           rcu_gp_cleanup(rsp))
> >                                 break;
> > +                       cond_resched();
> >                         flush_signals(current);
> >                 }
> >         }
> >         return 0;
> >  } 
> 
> Should there not be a kthread_stop() / kthread_park() call somewhere in
> there?

The kthread stops only when the system goes down, so no need for any
kthread_stop() or kthread_park().  The "return 0" suppresses complaints
about falling of the end of a non-void function.

> Also, it could be me, but all those nested for (;;) loops make the flow
> rather non-obvious.

For those two loops, I suppose I could pull the cond_resched() and
flush_signals() to the top, and make a do-while out of it.

							Thanx, Paul

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