Page MenuHomeFreeBSD

Remove redundant rounding logic from PMAP initialization
ClosedPublic

Authored by jtl on Feb 13 2018, 8:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 25, 12:26 AM
Unknown Object (File)
Thu, Nov 21, 6:28 PM
Unknown Object (File)
Thu, Nov 21, 6:28 PM
Unknown Object (File)
Thu, Nov 21, 6:27 PM
Unknown Object (File)
Thu, Nov 21, 6:06 PM
Unknown Object (File)
Oct 5 2024, 7:36 PM
Unknown Object (File)
Oct 3 2024, 2:07 AM
Unknown Object (File)
Oct 3 2024, 12:08 AM
Subscribers

Details

Summary

Prior to r329071, pmap_bootstrap() used pmap_kmem_choose() to round the first available virtual address to a 2MB boundary. After r329071, create_pagetables() rounds firstaddr up to a 2MB boundary. Therefore, it is no longer necessary for pmap_bootstrap() to round up to the 2MB boundary again.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 15023
Build 15126: arc lint + arc unit

Event Timeline

sys/amd64/amd64/pmap.c
1053

Then assert that the virtual_avail address is aligned on NBPDR.

sys/amd64/amd64/pmap.c
1053

We could do that; however, I'm not sure it is really important to do so.

As I understand it, the point of this restriction was so the kernel could be in 2MB pages, avoiding the overhead of maintaining 4KB paging structures for this space. However, the last several dozen pages prior to firstaddr are not the kernel, but rather are the first memory allocations made after bootup. I cannot see a reason why it is important to keep these in an isolated 2MB page. I can imagine a future change which would rework some of this and leave some of those allocations in 4KB pages, while keeping the kernel in 2MB pages.

With this in mind, is it really important to assert here that the kernel VA space must start on a 2MB page boundary? Is there some other reason it is important that this be invariant?

kib added inline comments.
sys/amd64/amd64/pmap.c
1053

Well, you did care to explain that the resulting alignment of subsequent 'raw' allocations did not changed after your patch, as an argumentation for the patch validity.

I think it is more important that previous allocation ends up consuming the aligned block, as explained in create_pagetables().

This revision is now accepted and ready to land.Feb 15 2018, 11:45 AM
This revision was automatically updated to reflect the committed changes.