Date: Wed, 8 Apr 2015 12:29:13 +0900 From: Masao Uebayashi <uebay...@gmail.com>
Considering these, PV should be kept in struct vm_physseg, instead of struct vm_page, ideally. The only difficulty with that is that you still need a fast way to go from a struct vm_page to the PV tracking record. Since vm_page has no pointer to vm_physseg, you'd need to add one in struct vm_page_md. But then you might as well just include the PV tracking record in the struct vm_page_md anyway. PV should be also an MI struct, like struct vm_pv. No objection here. I think everyone would like to see MI code for PV tracking instead of having copypasta in every pmap. But someone has to do the work. If you once have such a right design, you no longer need to have a separate API to track PV, because pmap_enter() is given sufficient information to decide whether PV is tracked or not; P/V addresses and flags telling how to map the new virtual address (cache enabled, PAT used, etc.). In my pmap_pv API, there's no need to change pmap_enter. All you need to do is to call pmap_pv_track on driver attach to mark the pages as device pages. Then pmap can do the bookkeeping inside. It sounds like what you're proposing is to replace pmap_pv_track by a version of uvm_page_physload that will not allocate struct vm_page for each page in the region, but only struct vm_pv. I have no objection to this either, but someone has to do the work.