Not sure I get it, the rwlock when is not released when you yield()). So
this will in fact context switch holding the rwlock for every pool_get().
Did I miss another a change ?




On Tue, 24 Jan 2017 at 07:48, Martin Pieuchot <m...@openbsd.org> wrote:

> I'd like to force a yield() for every pool_get(9) using PR_WAITOK, just
>
> like we do with malloc(9), in order to ensure that the NET_LOCK() is not
>
> held across context switches.
>
>
>
> ok?
>
>
>
> Index: kern/subr_pool.c
>
> ===================================================================
>
> RCS file: /cvs/src/sys/kern/subr_pool.c,v
>
> retrieving revision 1.204
>
> diff -u -p -r1.204 subr_pool.c
>
> --- kern/subr_pool.c    21 Nov 2016 01:44:06 -0000      1.204
>
> +++ kern/subr_pool.c    24 Jan 2017 06:29:09 -0000
>
> @@ -513,7 +513,7 @@ pool_get(struct pool *pp, int flags)
>
>         }
>
>         mtx_leave(&pp->pr_mtx);
>
>
>
> -       if (slowdown && ISSET(flags, PR_WAITOK))
>
> +       if ((slowdown || pool_debug == 2) && ISSET(flags, PR_WAITOK))
>
>                 yield();
>
>
>
>         if (v == NULL) {
>
>
>
>

Reply via email to