On Tue, Dec 15, 2020 at 09:15:31AM -0300, Martin Pieuchot wrote:
> On 11/12/20(Fri) 19:17, Scott Cheloha wrote:
> > Here's another sleep that doesn't need lbolt.
> > 
> > The idea here is to call apm_periodic_check() once a second.
> > We can do that without lbolt.
> > 
> > Is there some other address that would be more appropriate for this
> > thread to sleep on?  It doesn't look like any apm(4) code calls
> > wakeup(9) on lbolt so I've just replaced with with a local channel.
> 
> Note sure we want to grow the stack just for that.  Any member of `sc',
> or even `sc' itself if this doesn't conflict, could be used as wait
> channel.

Assuming we go ahead with the global nowake channel, is this ok?

Index: apm.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/i386/apm.c,v
retrieving revision 1.125
diff -u -p -r1.125 apm.c
--- apm.c       24 Jun 2020 22:03:40 -0000      1.125
+++ apm.c       23 Dec 2020 21:03:50 -0000
@@ -909,7 +909,7 @@ apm_thread(void *v)
                rw_enter_write(&sc->sc_lock);
                (void) apm_periodic_check(sc);
                rw_exit_write(&sc->sc_lock);
-               tsleep_nsec(&lbolt, PWAIT, "apmev", INFSLP);
+               tsleep_nsec(nowake, PWAIT, "apmev", SEC_TO_NSEC(1));
        }
 }
 

Reply via email to