Page MenuHomeFreeBSD

Simplify leaf_alloc, improve some hints
ClosedPublic

Authored by dougm on Dec 4 2019, 6:03 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Mar 24, 9:00 AM
Unknown Object (File)
Mar 17 2024, 7:00 AM
Unknown Object (File)
Mar 4 2024, 3:11 AM
Unknown Object (File)
Jan 16 2024, 7:53 AM
Unknown Object (File)
Jan 10 2024, 11:44 AM
Unknown Object (File)
Jan 5 2024, 8:19 AM
Unknown Object (File)
Dec 20 2023, 1:54 AM
Unknown Object (File)
Nov 7 2023, 7:10 PM
Subscribers

Details

Summary

Simplify the processing a leaf mask to find big-enough ranges of set bits, by storing and modifying the complement of the original leaf mask, and by avoiding some unnecessary intermediate variables in computing the shift amounts. The logic is similar to what has recently been committed to sys/sys/bitstring.h.

Compute better hint updates for the case when the cursor starts in mid-leaf, and eliminates some otherwise viable solutions. Assume the worst case, that all the eliminated offsets could have been solutions, and you can still compute a better hint than we use now.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

On the whole, this is okay. Just ask Peter to test it.

sys/kern/subr_blist.c
724 ↗(On Diff #65199)

With modern compilers, there is no machine-level benefit to using a predecrement operation within this expression.

787–790 ↗(On Diff #65199)

This is creating conditional control flow where it doesn't need to exist. In such a simple, the compiler figures this out, and avoids the compare-and-branch.

dougm marked 2 inline comments as done.
dougm added a subscriber: pho.

Apply reviewer's suggestions.

I ran tests for 20 hours on D22666.65577.diff without seeing any problems.

This revision is now accepted and ready to land.Dec 14 2019, 6:21 PM