On Tue, Jan 24, 2017 at 04:46:01PM +1000, Martin Pieuchot 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?
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) {
>