Skip to content

Commit

Permalink
uma: make UMA_RECLAIM_DRAIN_CPU drain SMR free buckets
Browse files Browse the repository at this point in the history
This very aggressive drain should probably be encoded with
a different request.  Now it is a PoC that allows to drain
all pcb zones on VNET jail destroy.
  • Loading branch information
glebius committed Dec 30, 2021
1 parent ca27896 commit f275704
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions sys/vm/uma_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1448,22 +1448,20 @@ cache_drain_safe_cpu(uma_zone_t zone, void *unused)
cache = &zone->uz_cpu[curcpu];
domain = PCPU_GET(domain);
b1 = cache_bucket_unload_alloc(cache);

/*
* Don't flush SMR zone buckets. This leaves the zone without a
* bucket and forces every free to synchronize().
*/
if ((zone->uz_flags & UMA_ZONE_SMR) == 0) {
b2 = cache_bucket_unload_free(cache);
b3 = cache_bucket_unload_cross(cache);
}
b2 = cache_bucket_unload_free(cache);
b3 = cache_bucket_unload_cross(cache);
critical_exit();

if (b1 != NULL)
zone_free_bucket(zone, b1, NULL, domain, false);
if (b2 != NULL)
if (b2 != NULL) {
if ((zone->uz_flags & UMA_ZONE_SMR) != 0)
b2->ub_seq = smr_advance(zone->uz_smr);
zone_free_bucket(zone, b2, NULL, domain, false);
}
if (b3 != NULL) {
if ((zone->uz_flags & UMA_ZONE_SMR) != 0)
b3->ub_seq = smr_advance(zone->uz_smr);
/* Adjust the domain so it goes to zone_free_cross. */
domain = (domain + 1) % vm_ndomains;
zone_free_bucket(zone, b3, NULL, domain, false);
Expand Down

0 comments on commit f275704

Please sign in to comment.