git: a04ce833f9ba - main - uma: Avoid polling for an invalid SMR sequence number
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 14 Jan 2022 20:39:33 UTC
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a04ce833f9ba058ec3e04f686bd56fa0691bfcf0 commit a04ce833f9ba058ec3e04f686bd56fa0691bfcf0 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2022-01-14 20:06:48 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2022-01-14 20:38:02 +0000 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 --- sys/vm/uma_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index e114e43184bd..f6f7b083133a 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -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); /*