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)
Sat, Aug 16, 6:13 PM
Unknown Object (File)
Sat, Aug 16, 9:03 AM
Unknown Object (File)
Sat, Aug 2, 4:36 PM
Unknown Object (File)
Sat, Aug 2, 1:36 PM
Unknown Object (File)
Mon, Jul 28, 2:49 PM
Unknown Object (File)
Fri, Jul 25, 1:52 AM
Unknown Object (File)
Jul 23 2025, 2:08 AM
Unknown Object (File)
Jul 6 2025, 9:47 PM
Subscribers

Details

Summary

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

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.