This change has us opportunistically updating the page's dirty field in pmap_ts_referenced(). I think that the comments explain the benefits.
This won't eliminate pmap_is_modified() calls when the page is not mapped for write access, but those cases are handled efficiently by pmap_is_modified() using the PGA_WRITEABLE flag. Only writeable pages that have not been written to will bear the full cost of pmap_is_modified().
This is a work in progress. I've only written the amd64 implementation as a demonstration.