Deleted Added
full compact
29c29
< __FBSDID("$FreeBSD: head/sys/kern/kern_mbuf.c 295221 2016-02-03 22:02:36Z glebius $");
---
> __FBSDID("$FreeBSD: head/sys/kern/kern_mbuf.c 295222 2016-02-03 23:30:17Z glebius $");
277,282d276
< * Callout to assist us in freeing mbufs.
< */
< static struct callout mb_reclaim_callout;
< static struct mtx mb_reclaim_callout_mtx;
<
< /*
294c288
< static void mb_reclaim(void *);
---
> static void mb_reclaim(uma_zone_t, int);
296d289
< static void mb_maxaction(uma_zone_t);
322c315
< uma_zone_set_maxaction(zone_mbuf, mb_maxaction);
---
> uma_zone_set_maxaction(zone_mbuf, mb_reclaim);
335c328
< uma_zone_set_maxaction(zone_clust, mb_maxaction);
---
> uma_zone_set_maxaction(zone_clust, mb_reclaim);
352c345
< uma_zone_set_maxaction(zone_jumbop, mb_maxaction);
---
> uma_zone_set_maxaction(zone_jumbop, mb_reclaim);
366c359
< uma_zone_set_maxaction(zone_jumbo9, mb_maxaction);
---
> uma_zone_set_maxaction(zone_jumbo9, mb_reclaim);
380c373
< uma_zone_set_maxaction(zone_jumbo16, mb_maxaction);
---
> uma_zone_set_maxaction(zone_jumbo16, mb_reclaim);
387,393d379
< /* uma_prealloc() goes here... */
<
< /* Initialize the mb_reclaim() callout. */
< mtx_init(&mb_reclaim_callout_mtx, "mb_reclaim_callout_mtx", NULL,
< MTX_DEF);
< callout_init(&mb_reclaim_callout, 1);
<
680c666,667
< * This is the protocol drain routine.
---
> * This is the protocol drain routine. Called by UMA whenever any of the
> * mbuf zones is closed to its limit.
687c674
< mb_reclaim(void *junk)
---
> mb_reclaim(uma_zone_t zone __unused, int pending __unused)
692,693c679
< WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK | WARN_PANIC, NULL,
< "mb_reclaim()");
---
> WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK | WARN_PANIC, NULL, __func__);
700,757d685
<
< /*
< * This is the function called by the mb_reclaim_callout, which is
< * used when we hit the maximum for a zone.
< *
< * (See mb_maxaction() below.)
< */
< static void
< mb_reclaim_timer(void *junk __unused)
< {
<
< mtx_lock(&mb_reclaim_callout_mtx);
<
< /*
< * Avoid running this function extra times by skipping this invocation
< * if the callout has already been rescheduled.
< */
< if (callout_pending(&mb_reclaim_callout) ||
< !callout_active(&mb_reclaim_callout)) {
< mtx_unlock(&mb_reclaim_callout_mtx);
< return;
< }
< mtx_unlock(&mb_reclaim_callout_mtx);
<
< mb_reclaim(NULL);
<
< mtx_lock(&mb_reclaim_callout_mtx);
< callout_deactivate(&mb_reclaim_callout);
< mtx_unlock(&mb_reclaim_callout_mtx);
< }
<
< /*
< * This function is called when we hit the maximum for a zone.
< *
< * At that point, we want to call the protocol drain routine to free up some
< * mbufs. However, we will use the callout routines to schedule this to
< * occur in another thread. (The thread calling this function holds the
< * zone lock.)
< */
< static void
< mb_maxaction(uma_zone_t zone __unused)
< {
<
< /*
< * If we can't immediately obtain the lock, either the callout
< * is currently running, or another thread is scheduling the
< * callout.
< */
< if (!mtx_trylock(&mb_reclaim_callout_mtx))
< return;
<
< /* If not already scheduled/running, schedule the callout. */
< if (!callout_active(&mb_reclaim_callout)) {
< callout_reset(&mb_reclaim_callout, 1, mb_reclaim_timer, NULL);
< }
<
< mtx_unlock(&mb_reclaim_callout_mtx);
< }