Commit a04ce833 authored by Mark Johnston's avatar Mark Johnston
Browse files

uma: Avoid polling for an invalid SMR sequence number

Buckets in an SMR-enabled zone can legitimately be tagged with
SMR_SEQ_INVALID.  This effectively means that the zone destructor (if
any) was invoked on all items in the bucket, and the contained memory is
safe to reuse.  If the first bucket in the full bucket list was tagged
this way, UMA would unnecessarily poll per-CPU state before attempting
to fetch a full bucket from the list.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
parent 4a864f62
......@@ -1051,6 +1051,7 @@ cache_fetch_bucket(uma_zone_t zone, uma_cache_t cache, int domain)
{
uma_zone_domain_t zdom;
uma_bucket_t bucket;
smr_seq_t seq;
/*
* Avoid the lock if possible.
......@@ -1060,7 +1061,8 @@ cache_fetch_bucket(uma_zone_t zone, uma_cache_t cache, int domain)
return (NULL);
if ((cache_uz_flags(cache) & UMA_ZONE_SMR) != 0 &&
!smr_poll(zone->uz_smr, zdom->uzd_seq, false))
(seq = atomic_load_32(&zdom->uzd_seq)) != SMR_SEQ_INVALID &&
!smr_poll(zone->uz_smr, seq, false))
return (NULL);
/*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment