It can useful for code outside the VM system to look up the NUMA domain
of a page backing a virtual or physical address, specifically when
creating NUMA-aware data structures. We have
_vm_phys_domain() for this, but the leading underscore implies that it's
an internal function, and vm_phys.h has dependencies on a number of
other headers. This diff tries to make _vm_phys_domain() a bit easier
to use:
- Rename vm_phys_domain() to vm_phys_page_domain(). That function is
only used by the VM; I think it's ok to use a somewhat longer name.
- Compile vm_phys_page_domain() only if vm_page.h is included, since it
references vm_page fields but is not often used.
- Conditionally define struct pglist, like we do in vm_object.h.
- Rename _vm_phys_domain() to vm_phys_domain() and provide an inline
implementation.
- Include machine/vmparam.h in vm_phys.h since the layout of struct
vm_phys_seg depends on VM_NRESERVLEVEL.
- Remove the size of phys_avail[] from the declaration, to avoid a
dependency on vm/vmparam.h. Note that mem_affinity[] is similarly
declared without an explicit size.