Peter Zijlstra wrote: >People expressed the need to track dirty pages in shared mappings. >Linus outlined the general idea of doing that through making clean >writable pages write-protected and taking the write fault. > >This patch does exactly that, it makes pages in a shared writable >mapping write-protected. On write-fault the pages are marked dirty and >made writable. When the pages get synced with their backing store, the >write-protection is re-instated. > >It survives a simple test and shows the dirty pages in /proc/vmstat. > >Comments? > Looks pretty good. Christoph and I were looking at ways to improve performance impact of this, and skipping the extra work for particular (eg. shmem) mappings might be a good idea? Attached is a patch with a couple of things I've currently got. In the long run, I'd like to be able to set_page_dirty and balance_dirty_pages outside of both ptl and mmap_sem, for performance reasons. That will require a reworking of arch code though :(