Mark Kettenis <mark.kette...@xs4all.nl> wrote:

> > Date: Tue, 14 Jan 2020 10:34:05 +1100
> > From: Jonathan Gray <j...@jsg.id.au>
> > 
> > On Mon, Jan 13, 2020 at 05:02:12PM +0100, Martin Pieuchot wrote:
> > > I'm facing a lock ordering issue while profiling the scheduler which
> > > cannot be solved without using a different lock for the global sleepqueue
> > > and the runqueues.
> > > 
> > > The SCHED_LOCK() currently protects both data structures as well as the
> > > related fields in 'struct proc'.  One of this fields is `p_wchan' which
> > > is obviously related to the global sleepqueue.
> > > 
> > > The cleaning diff below introduces a new function, awake(), that unify
> > > the multiple uses of the following idiom:
> > > 
> > >   if (p->p_stat == SSLEEP)
> > >           setrunnable(p);
> > >   else
> > >           unsleep(p);
> > > 
> > > This is generally done after checking if the thread `p' is on the
> > > sleepqueue.
> > 
> > Why not name it wakeup_proc() instead or something like endsleep()?
> > 
> > awake() does not describe the action that is being done and
> > if (awake()) reads like it could be
> > if (p->p_stat != SSLEEP && p->p_stat != SSTOP)
> 
> Must say I had reservations about the "awake" name as well, but jsg@
> nails it here since it both a verb and an adjective which creates
> confusion.  Both names suggester here are find I think.

If you want an active verb that avoids the adjective confusion, you can
consider awaken()

Reply via email to