Page MenuHomeFreeBSD

Change free space search to avoid duplicate search
ClosedPublic

Authored by dougm on Jan 19 2022, 8:22 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 24, 1:39 AM
Unknown Object (File)
Thu, Apr 11, 10:57 PM
Unknown Object (File)
Thu, Apr 11, 10:01 PM
Unknown Object (File)
Tue, Apr 9, 11:34 PM
Unknown Object (File)
Sun, Mar 31, 4:10 AM
Unknown Object (File)
Mar 12 2024, 4:02 AM
Unknown Object (File)
Mar 9 2024, 8:37 AM
Unknown Object (File)
Mar 7 2024, 11:48 PM
Subscribers

Details

Summary

In the search for free space, do not examine the same free list set more than once, since several segments can have the same free list set.

Test Plan

I can't test right now, so hopefully this is foolproof-ly simple.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dougm requested review of this revision.Jan 19 2022, 8:22 AM
dougm created this revision.
dougm edited the summary of this revision. (Show Details)

Allow a less-than-max-sized free block to complete the allocation.

dougm edited the summary of this revision. (Show Details)

Change the process of stringing together free blocks to satisfy a request to allow smaller blocks at the beginning and end of the sequence. When a free block is not part of a large enough range to satisfy the request, move the largest free blocks in the sequence in their free list so that they aren't encountered more than once in the search. When a request for a number of pages less then the maximum block size cannot be satisfied with a single free block, try to piece a sequence of smaller free blocks together before giving up.

dougm retitled this revision from Base free space search on free list sets, not segments to Change free space search to avoid duplcate search, find tighter fits.
dougm edited the summary of this revision. (Show Details)

Eliminate typedef. Eliminate gotos.

dougm retitled this revision from Change free space search to avoid duplcate search, find tighter fits to Change free space search to avoid duplicate search, find tighter fits.Mar 11 2022, 9:51 AM

I got this panic from a contigmalloc() test:

panic: vm_phys_enq_range: page 0xfffffe0031509980 and npages 2048 are misaligned

https://people.freebsd.org/~pho/stress/log/log0273.txt

dougm retitled this revision from Change free space search to avoid duplicate search, find tighter fits to Change free space search to avoid duplicate search.
dougm edited the summary of this revision. (Show Details)
dougm edited the test plan for this revision. (Show Details)

Throw out almost everything.

I do, however, think that this deserves explanation in the form of a comment.

This revision is now accepted and ready to land.Mar 28 2022, 5:34 PM

Peter, can you please test this?

In D33947#786068, @alc wrote:

Peter, can you please test this?

Oh, yes. I've been running tests with D33947.104249.patch for more than a day. Still about 24 hours left.

vm_phys_alloc_seg_contig() will ignore runs of pages that aren't contained in the range [seg->start, seg->end], so doesn't this change potentially cause us to skip over eligible runs?

vm_phys_alloc_seg_contig() will ignore runs of pages that aren't contained in the range [seg->start, seg->end], so doesn't this change potentially cause us to skip over eligible runs?

Yes, you are correct. Nonetheless, we are currently iterating over the same free list for each segment that references it. I would suggest changing vm_phys_alloc_seg_contig to take the free list rather than the seg as its first parameter. When it needs the seg, it can derive it from the selected page.

vm_phys_alloc_seg_contig() will ignore runs of pages that aren't contained in the range [seg->start, seg->end], so doesn't this change potentially cause us to skip over eligible runs?

Yes. I agree. I had addressed that once, before I stripped this patch down too far. I'll reintroduce the changes that address that.

Go back to allocating from queues, not segments.

This revision now requires review to proceed.Mar 28 2022, 6:34 PM
This revision is now accepted and ready to land.Mar 29 2022, 4:35 PM

I'll commit this tomorrow, if no one has more to say about it.

I'm almost done with testing the D33947.104303.patch. No problems seen so far. A full stress2 test takes two days to complete.

The stress2 test suite completed with any issues.

The reporter of this bug:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=274592

has offered experimental evidence that this change is responsible for that bug.