Page MenuHomeFreeBSD

uma: UMA_ALIGN_CACHE: Resolve the proper value at use point
ClosedPublic

Authored by olce on Oct 17 2023, 2:50 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Oct 29, 9:58 PM
Unknown Object (File)
Sat, Oct 19, 7:42 PM
Unknown Object (File)
Sat, Oct 19, 7:42 PM
Unknown Object (File)
Sat, Oct 19, 7:42 PM
Unknown Object (File)
Sat, Oct 19, 7:41 PM
Unknown Object (File)
Sat, Oct 19, 7:28 PM
Unknown Object (File)
Oct 13 2024, 11:30 PM
Unknown Object (File)
Sep 24 2024, 3:13 PM
Subscribers

Details

Summary

Having a special value of -1 that is resolved internally to
'uma_align_cache' provides no significant advantages and prevents
changing that variable to an unsigned type, which is natural for an
alignment mask. So suppress it and replace its use with a call to
uma_get_align_mask(). The small overhead of the added function call is
irrelevant since UMA_ALIGN_CACHE is only used when creating new zones,
which is not performance critical.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 54070
Build 50960: arc lint + arc unit

Event Timeline

olce requested review of this revision.Oct 17 2023, 2:50 PM
This revision is now accepted and ready to land.Oct 17 2023, 3:09 PM
sys/vm/uma_core.c
3259

Perhaps add asserts checking that mask is reasonable. I wonder if there are cases where -1 was passed by some reason.

As I understand, the check should be that align is > 0 and is some power of two - 1.

olce marked an inline comment as done.
olce edited the summary of this revision. (Show Details)

Add tags to the commit message.

This revision now requires review to proceed.Oct 19 2023, 8:02 AM
sys/vm/uma_core.c
3259

Already done in D42263. The first point, alignment > 0, is automatically true since the mask is switched to unsigned int type in the next patch (see D42262).

This revision is now accepted and ready to land.Oct 19 2023, 11:49 AM