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

Function zone_put_bucket

freebsd/vm/uma_core.c:703–739  ·  view source on GitHub ↗

* Insert a full bucket into the specified cache. The "ws" parameter indicates * whether the bucket's contents should be counted as part of the zone's working * set. The bucket may be freed if it exceeds the bucket limit. */

Source from the content-addressed store, hash-verified

701 * set. The bucket may be freed if it exceeds the bucket limit.
702 */
703static void
704zone_put_bucket(uma_zone_t zone, int domain, uma_bucket_t bucket, void *udata,
705 const bool ws)
706{
707 uma_zone_domain_t zdom;
708
709 /* We don't cache empty buckets. This can happen after a reclaim. */
710 if (bucket->ub_cnt == 0)
711 goto out;
712 zdom = zone_domain_lock(zone, domain);
713
714 /*
715 * Conditionally set the maximum number of items.
716 */
717 zdom->uzd_nitems += bucket->ub_cnt;
718 if (__predict_true(zdom->uzd_nitems < zone->uz_bucket_max)) {
719 if (ws)
720 zone_domain_imax_set(zdom, zdom->uzd_nitems);
721 if (STAILQ_EMPTY(&zdom->uzd_buckets))
722 zdom->uzd_seq = bucket->ub_seq;
723
724 /*
725 * Try to promote reuse of recently used items. For items
726 * protected by SMR, try to defer reuse to minimize polling.
727 */
728 if (bucket->ub_seq == SMR_SEQ_INVALID)
729 STAILQ_INSERT_HEAD(&zdom->uzd_buckets, bucket, ub_link);
730 else
731 STAILQ_INSERT_TAIL(&zdom->uzd_buckets, bucket, ub_link);
732 ZDOM_UNLOCK(zdom);
733 return;
734 }
735 zdom->uzd_nitems -= bucket->ub_cnt;
736 ZDOM_UNLOCK(zdom);
737out:
738 bucket_free(zone, bucket, udata);
739}
740
741/* Pops an item out of a per-cpu cache bucket. */
742static inline void *

Callers 4

cache_allocFunction · 0.85
uma_zalloc_domainFunction · 0.85
zone_free_crossFunction · 0.85
zone_free_bucketFunction · 0.85

Calls 3

zone_domain_lockFunction · 0.85
zone_domain_imax_setFunction · 0.85
bucket_freeFunction · 0.70

Tested by

no test coverage detected