Mark the pages used for the initial page-table entries as wired. This makes them consistent with the way other page-table pages are allocated.
Details
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 14900 Build 15012: arc lint + arc unit
Event Timeline
Is there any other reason than the consistency with other page table pages for this change ?
sys/amd64/amd64/pmap.c | ||
---|---|---|
1247 | I suggest to directly assign the wire_count to 1, then you do not need the page lock. |
This is not due to a bug. Actually, I noticed this while I was auditing this code to see if it was the cause of an obscure bug. I couldn't find anyplace where this code caused a problem. (And, it appears our obscure bug has another cause.)
However, since r274556, these pages are added to the VM system as physical segments. This means that things in the VM system could be scanning them. For example, vm_phys_scan_contig() may scan these. It may run vm_page_scan_contig() over these to see if there are enough free contiguous pages. Now, vm_page_scan_contig() will reject these because m->order == VM_NFREEORDER. However, it seems like it would be easy to introduce a bug somewhere in one of these scanning routines to make it actually consider these free pages.
For that reason, it seemed like a good idea to mark these as wired.
sys/amd64/amd64/pmap.c | ||
---|---|---|
1247 | OK. I was trying to use the API, but I agree that taking the lock is completely unnecessary here (other than to use the API). |
sys/amd64/amd64/pmap.c | ||
---|---|---|
1247 | v_wire_count ought to be bumped too for consistency. |
sys/amd64/amd64/pmap.c | ||
---|---|---|
1248 | You can increment v_wire_count by nkpt after the loop. More, I think that the increment does not need to be atomic. |
sys/amd64/amd64/pmap.c | ||
---|---|---|
1248 | I'm not sure I'd bother avoiding the locked increment. It's not much more expensive, and the reason for the inconsistency isn't immediately obvious when reading the code. |