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

Function tcp_hc_purge_internal

freebsd/netinet/tcp_hostcache.c:689–710  ·  view source on GitHub ↗

* Caller has to make sure the curvnet is set properly. */

Source from the content-addressed store, hash-verified

687 * Caller has to make sure the curvnet is set properly.
688 */
689static void
690tcp_hc_purge_internal(int all)
691{
692 struct hc_metrics *hc_entry, *hc_next;
693 int i;
694
695 for (i = 0; i < V_tcp_hostcache.hashsize; i++) {
696 THC_LOCK(&V_tcp_hostcache.hashbase[i].hch_mtx);
697 TAILQ_FOREACH_SAFE(hc_entry,
698 &V_tcp_hostcache.hashbase[i].hch_bucket, rmx_q, hc_next) {
699 if (all || hc_entry->rmx_expire <= 0) {
700 TAILQ_REMOVE(&V_tcp_hostcache.hashbase[i].hch_bucket,
701 hc_entry, rmx_q);
702 uma_zfree(V_tcp_hostcache.zone, hc_entry);
703 V_tcp_hostcache.hashbase[i].hch_length--;
704 V_tcp_hostcache.cache_count--;
705 } else
706 hc_entry->rmx_expire -= V_tcp_hostcache.prune;
707 }
708 THC_UNLOCK(&V_tcp_hostcache.hashbase[i].hch_mtx);
709 }
710}
711
712/*
713 * Expire and purge (old|all) entries in the tcp_hostcache. Runs

Callers 3

tcp_hc_destroyFunction · 0.85
tcp_hc_purgeFunction · 0.85
sysctl_tcp_hc_purgenowFunction · 0.85

Calls 1

uma_zfreeFunction · 0.50

Tested by

no test coverage detected