Hi,

srp_finalize(9) uses tsleep(9) to spin while it waits for the object's
refcount to reach zero.  It blocks for up to 1 tick and then checks
the refecount again and again.

We can just as easily do this with tsleep_nsec(9) and block for 1
millisecond per interval.

ok?

Index: kern_srp.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_srp.c,v
retrieving revision 1.12
diff -u -p -r1.12 kern_srp.c
--- kern_srp.c  8 Sep 2017 05:36:53 -0000       1.12
+++ kern_srp.c  4 Dec 2020 04:04:39 -0000
@@ -274,7 +274,7 @@ void
 srp_finalize(void *v, const char *wmesg)
 {
        while (srp_referenced(v))
-               tsleep(v, PWAIT, wmesg, 1);
+               tsleep_nsec(v, PWAIT, wmesg, MSEC_TO_NSEC(1));
 }
 
 #else /* MULTIPROCESSOR */

Reply via email to