Page MenuHomeFreeBSD

Stop updating leaf hint after last block allocation when cursor affected resul
ClosedPublic

Authored by dougm on Dec 7 2018, 4:23 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 21, 11:16 PM
Unknown Object (File)
Sep 21 2024, 6:18 AM
Unknown Object (File)
Sep 18 2024, 4:46 PM
Unknown Object (File)
Sep 5 2024, 9:52 PM
Unknown Object (File)
Aug 15 2024, 11:15 AM
Unknown Object (File)
Aug 11 2024, 10:38 PM
Unknown Object (File)
Jul 31 2024, 11:18 PM
Unknown Object (File)
Jul 29 2024, 2:51 AM
Subscribers

Details

Summary

blst_leaf_alloc updates bighint for a leaf when an allocation is successful and includes the last block represented by the leaf. The reasoning is that, if the last block is included, then there must be no solution before that one in the leaf, so the leaf cannot provide an allocation that big again; indeed, the leaf cannot provide a solution bigger than range1.

Which is all correct, except that if the value of blk passed in did not represent the first block of the leaf, because the cursor was pointing to the middle of the leaf, then a possible solution before the cursor may have been ignored, and bighint cannot be updated.

Consider the sequence allocate 63 (returning address 0), free 0,63 (freeing that same block, and allocate 1 (returning 63. The result is that one block is allocated from the first leaf, and the value of bighint is 0, so that nothing can be allocated from that leaf until the only block allocated from that leaf is freed. This change detects that skipped-over solution, and when there is one it makes sure that the value of bighint is not changed when the last block is allocated.

Test Plan

Peter, please test this.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

sys/kern/subr_blist.c
695–696

I would suggest defining a new local variable for maintaining the value mask & bitrange(0, blk & BLIST_BMAP_MASK).

698–699

The prevailing style is to include a blank line before multiline comments unless the multiline comment begins a compound statement, i.e., comes immediately after the opening brace.

dougm marked 2 inline comments as done.

Adopt style suggestions. Slightly improve the quality of the bighint for this special case.

sys/kern/subr_blist.c
647

"This function is ... allocator. Its execution time ..."

665

"... Grow range1 and ..."

dougm marked 2 inline comments as done.

Apply reviewer suggestions.

sys/kern/subr_blist.c
703

"... other blocks are ..."

dougm marked an inline comment as done.

Ask Peter to test this patch.

This revision is now accepted and ready to land.Dec 8 2018, 4:38 AM
dougm added a subscriber: pho.

I ran all of the stress2 tests plus a buildworld / installworld. The stress2 test was split between two different hosts (mercat1 & flix1).
No problems seen.

This revision was automatically updated to reflect the committed changes.