Page MenuHomeFreeBSD

amd64: replace tailq pointers with iterators
ClosedPublic

Authored by dougm on Apr 20 2025, 5:45 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Dec 3, 1:09 PM
Unknown Object (File)
Mon, Nov 24, 8:25 PM
Unknown Object (File)
Mon, Nov 24, 7:30 PM
Unknown Object (File)
Mon, Nov 24, 7:30 PM
Unknown Object (File)
Mon, Nov 24, 7:30 PM
Unknown Object (File)
Mon, Nov 24, 7:29 PM
Unknown Object (File)
Wed, Nov 19, 4:02 AM
Unknown Object (File)
Mon, Nov 17, 3:56 AM
Subscribers

Details

Summary

Change architecture-specific code to use iterators rather than tailq pointers.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

dougm requested review of this revision.Apr 20 2025, 5:45 AM
dougm created this revision.
This revision is now accepted and ready to land.Apr 20 2025, 12:34 PM
sys/amd64/amd64/pmap.c
7711

Why can't we just assign m = m_start?

7942

The vm_object_populate() call above guarantees that the object has resident pages for pindices [pindex, pindex+size). I don't think we can have p == NULL here.

7944

Why is it ok to drop the physical address check?

sys/amd64/amd64/pmap.c
7711

That won't set pages.index to m_start->pindex, so iter_step() and iter_jump() will be adding to an incorrect or uninitialized value to update the index value.

7944

Because line 7940 is
p = vm_radix_iter_next(&pages);
and not
p = vm_radix_iter_step(&pages);

The latter would be equivalent to "p = TAILQ_NEXT(p, listq). The former gets the page with the next address, and gets NULL if there is no such page.

sys/amd64/amd64/pmap.c
7944

Contiguity in the pindex space doesn't imply contiguity in the physical address space. The vm_object_populate() call ensures that a page is resident at all pindices in the range, so the old code could have equivalently used vm_page_next().

Drop null check. Restore physical address check.

This revision now requires review to proceed.Apr 20 2025, 8:19 PM
This revision is now accepted and ready to land.Apr 20 2025, 11:25 PM
This revision was automatically updated to reflect the committed changes.