Page MenuHomeFreeBSD

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

Authored by markj on Aug 11 2020, 2:41 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 23 2023, 4:35 AM
Unknown Object (File)
Sep 4 2023, 5:07 PM
Unknown Object (File)
Apr 26 2023, 3:55 AM
Unknown Object (File)
Apr 8 2023, 12:50 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.