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)
Dec 25 2023, 10:03 PM
Unknown Object (File)
Dec 20 2023, 4:17 AM
Unknown Object (File)
Nov 21 2023, 8:14 AM
Unknown Object (File)
Nov 19 2023, 8:27 AM
Unknown Object (File)
Nov 7 2023, 7:10 AM
Unknown Object (File)
Nov 7 2023, 4:24 AM
Unknown Object (File)
Oct 17 2023, 8:02 AM
Unknown Object (File)
Oct 15 2023, 7:16 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 Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/amd64/amd64/pmap.c
1053 ↗(On Diff #39274)

Then assert that the virtual_avail address is aligned on NBPDR.

sys/amd64/amd64/pmap.c
1053 ↗(On Diff #39274)

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 ↗(On Diff #39274)

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.