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
F115641216: D48632.diff
Sat, Apr 26, 10:32 AM
Unknown Object (File)
Mon, Apr 21, 4:43 AM
Unknown Object (File)
Mon, Apr 21, 1:40 AM
Unknown Object (File)
Sat, Apr 19, 2:54 PM
Unknown Object (File)
Sat, Apr 19, 1:12 PM
Unknown Object (File)
Sat, Apr 19, 10:48 AM
Unknown Object (File)
Thu, Apr 17, 11:18 AM
Unknown Object (File)
Thu, Apr 17, 6:49 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 61931
Build 58815: arc lint + arc unit

Event Timeline

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

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

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

No, I just wasn't thinking too clearly.

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