Page MenuHomeFreeBSD

vm_page_startup(): Clarify memory lowest, highest and size computation
ClosedPublic

Authored by olce on Jan 23 2025, 5:16 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Mar 6, 2:15 PM
Unknown Object (File)
Tue, Mar 4, 4:16 AM
Unknown Object (File)
Fri, Feb 28, 4:42 PM
Unknown Object (File)
Fri, Feb 21, 5:50 PM
Unknown Object (File)
Wed, Feb 19, 2:18 PM
Unknown Object (File)
Mon, Feb 17, 4:02 AM
Unknown Object (File)
Feb 4 2025, 3:11 AM
Unknown Object (File)
Feb 1 2025, 7:39 AM
Subscribers

Details

Summary

Change the comment before this block of code, and separate the latter
from the preceding one by an empty line.

Move the loop on phys_avail[] to compute the minimum and maximum memory
physical addresses closer to the initialization of 'low_avail' and
'high_avail', so that it's immediately clear why the loop starts at
2 (and remove the related comment).

While here, fuse the additional loop in the VM_PHYSSEG_DENSE case that
is used to compute the exact physical memory size.

This change suppresses one occurence of detecting whether at least one
of VM_PHYSSEG_DENSE or VM_PHYSSEG_SPARSE is defined at compile time, but
there is still another one in PHYS_TO_VM_PAGE().

Diff Detail

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

Event Timeline

olce requested review of this revision.Jan 23 2025, 5:16 PM
sys/vm/vm_page.c
690–691

I think I'd find this assignment clearer if it was moved to before the two loops, where size is initialized for the PHYSSEG_SPARSE case.

olce marked an inline comment as done.Jan 24 2025, 4:42 PM
olce added inline comments.
sys/vm/vm_page.c
690–691

Maybe I'm misunderstanding your suggestion, but if it's effectively moving up the size assignment in VM_PHYSSEG_DENSE case, it just can't because low_avail and high_avail are computed by the two loops and it must come after them.

markj added inline comments.
sys/vm/vm_page.c
690–691

No, I just wasn't thinking too clearly.

This revision is now accepted and ready to land.Jan 24 2025, 4:45 PM