On Thu, 2021-08-05 at 22:51 +0000, Andrew Gallatin wrote: > The branch main has been updated by gallatin: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=09066b98663d92f4d129bab25105805adf0abaf7 > > commit 09066b98663d92f4d129bab25105805adf0abaf7 > Author: Andrew Gallatin <galla...@freebsd.org> > AuthorDate: 2021-08-05 21:19:12 +0000 > Commit: Andrew Gallatin <galla...@freebsd.org> > CommitDate: 2021-08-05 21:19:12 +0000 > > ktls: Use the new PNOLOCK flag > > Use the new PNOLOCK flag to tsleep() to indicate that > we are managing potential races, and don't need to > sleep with a lock, or have a backstop timeout. > > Reviewed by: jhb > Sponsored by: Netflix > --- > sys/kern/uipc_ktls.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c > index 47815c266667..1cc1f2e8b8c4 100644 > --- a/sys/kern/uipc_ktls.c > +++ b/sys/kern/uipc_ktls.c > @@ -2240,7 +2240,7 @@ ktls_alloc_thread(void *ctx) > nbufs = 0; > for (;;) { > atomic_store_int(&sc->running, 0); > - tsleep_sbt(sc, PZERO, "waiting for work", SBT_MAX, > SBT_1S, 0); > + tsleep(sc, PZERO | PNOLOCK, "-", 0); > atomic_store_int(&sc->running, 1); > sc->wakeups++; > if (nbufs != ktls_max_alloc) {
I especially like this solution, it documents explicitly what you're doing and why. (Earlier I was considering mumbling something about "there should be a comment to say a sleep-forever is known safe here".) -- Ian _______________________________________________ dev-commits-src-main@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"