Page MenuHomeFreeBSD

uma: Avoid polling for an invalid read sequence number.
AbandonedPublic

Authored by markj on Aug 11 2020, 2:41 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 7, 4:17 PM
Unknown Object (File)
Thu, Oct 31, 3:28 AM
Unknown Object (File)
Oct 4 2024, 11:25 AM
Unknown Object (File)
Sep 18 2024, 5:56 AM
Unknown Object (File)
Aug 11 2024, 10:40 AM
Unknown Object (File)
Aug 8 2024, 8:33 AM
Unknown Object (File)
Jul 24 2024, 5:04 AM
Unknown Object (File)
May 31 2024, 8:29 AM
Subscribers
None

Details

Reviewers
cem
rlibby
jeff
Summary

Otherwise we would poll for SMR_SEQ_INVALID in certain rare cases. In
this could potentially cause the full bucket cache to be bypassed in
situations where it contains items safe to reuse. It also results in
needless polling when the bucket cache is empty.

Update the cached value of the next full bucket's sequence number
precisely, and avoid polling at all if the cached value is invalid.
Modify smr_poll() to assert that the goal is valid.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 32909
Build 30307: arc lint + arc unit

Event Timeline

markj requested review of this revision.Aug 11 2020, 2:41 PM
markj created this revision.
sys/vm/uma_core.c
687

There are situations where the seq of the next bucket is SMR_SEQ_INVALID. For example, if cache_alloc() allocates a new bucket, fills it, and discovers that it lost a race with another thread trying to refill the alloc cache, it will place a full bucket with ub_seq == SMR_SEQ_INVALID in the cache.

Seems fine to me, although I am not very familiar with UMA.

sys/vm/uma_core.c
907

Would it make sense to define atomic foo seq aliases in an SMR header in place of using specific sized routines for a typeded’d type?

This revision is now accepted and ready to land.Aug 11 2020, 2:54 PM
sys/vm/uma_core.c
907

I'm not sure. UMA and SMR are tightly coupled (for example, some UMA struct layouts assume that smr_seq_t is 32 bits wide), so it doesn't really feel necessary here. If we start using SMR independent of UMA then it would make sense to start doing that.

sys/vm/uma_core.c
907

Works for me.

I committed a simpler version in a04ce833f9ba0.