For non-anonymous swap objects, there is always a reference from the owner to the object to keep it from recycling. Account for it when deciding should be query pmap for hardware active references for the page.
- rG3de96d664aaa: vm_pageout_scans: correct detection of active object
Am I right that this is effectively an optimization? For pages belonging to a named swap object we will call pmap_ts_referenced() unnecessarily, but the returned value will be correct (i.e., 0 if the page is unmapped).
This comment is out of date, the page lock is no longer used. If the page is deallocated, the references are generally lost. I can fix this in a follow-up.
This should presumably check whether ref_count > 1 for non-anonymous object.
Presumably this check should be updated too.
Now that you formulate it this way, I think yes. Then it is somewhat mistery what I saw on my machine, where active queue stayed infinitely long with large unmapped tmpfs objects. Anyway, this patch indeed saves at least one lock/unlock of pv lock per scanned page.
I do not think that references of the page being deallocated serve any use.
Hmm. I haven't seen such a problem before. Was the system otherwise idle? Which kernel revision was it running?
Anyway, this patch indeed saves at least one lock/unlock of pv lock per scanned page.
Yes, I think it's a worthy change.
I think the code would be more clear if we instead had bool vm_pageout_object_mapped(vm_object) which returned true if there is a mapping reference, and false otherwise.
This should be updated as well.