MCPcopy Create free account
hub / github.com/F-Stack/f-stack / zone_reclaim

Function zone_reclaim

freebsd/vm/uma_core.c:1473–1506  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1471}
1472
1473static void
1474zone_reclaim(uma_zone_t zone, int waitok, bool drain)
1475{
1476
1477 /*
1478 * Set draining to interlock with zone_dtor() so we can release our
1479 * locks as we go. Only dtor() should do a WAITOK call since it
1480 * is the only call that knows the structure will still be available
1481 * when it wakes up.
1482 */
1483 ZONE_LOCK(zone);
1484 while (zone->uz_flags & UMA_ZFLAG_RECLAIMING) {
1485 if (waitok == M_NOWAIT)
1486 goto out;
1487 msleep(zone, &ZDOM_GET(zone, 0)->uzd_lock, PVM, "zonedrain",
1488 1);
1489 }
1490 zone->uz_flags |= UMA_ZFLAG_RECLAIMING;
1491 ZONE_UNLOCK(zone);
1492 bucket_cache_reclaim(zone, drain);
1493
1494 /*
1495 * The DRAINING flag protects us from being freed while
1496 * we're running. Normally the uma_rwlock would protect us but we
1497 * must be able to release and acquire the right lock for each keg.
1498 */
1499 if ((zone->uz_flags & UMA_ZFLAG_CACHE) == 0)
1500 keg_drain(zone->uz_keg);
1501 ZONE_LOCK(zone);
1502 zone->uz_flags &= ~UMA_ZFLAG_RECLAIMING;
1503 wakeup(zone);
1504out:
1505 ZONE_UNLOCK(zone);
1506}
1507
1508static void
1509zone_drain(uma_zone_t zone, void *unused)

Callers 3

zone_drainFunction · 0.85
zone_trimFunction · 0.85
zone_dtorFunction · 0.85

Calls 3

bucket_cache_reclaimFunction · 0.85
keg_drainFunction · 0.85
wakeupFunction · 0.50

Tested by

no test coverage detected