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)
Fri, May 24, 12:24 PM
Unknown Object (File)
Apr 30 2024, 5:52 AM
Unknown Object (File)
Apr 30 2024, 5:52 AM
Unknown Object (File)
Apr 30 2024, 5:10 AM
Unknown Object (File)
Apr 30 2024, 5:10 AM
Unknown Object (File)
Apr 29 2024, 9:56 PM
Unknown Object (File)
Dec 27 2023, 4:04 AM
Unknown Object (File)
Dec 23 2023, 2:39 AM
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 Not Applicable
Unit
Tests Not Applicable

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