On Fri, Jan 17, 2025 at 12:56:52PM +0100, Jan Kara wrote: > On Fri 17-01-25 12:40:15, Vlastimil Babka wrote: > > I think this might be tricky in some cases? I.e. with 2 MB and pmd-mapped > > folio, it's possible to write-protect only the whole pmd, not individual 32k > > chunks in order to catch the first write to a chunk to mark it dirty. > > Definitely. Once you map a folio through PMD entry, you have no other > option than consider whole 2MB dirty. But with PTE mappings or > modifications through syscalls you can do more fine-grained dirtiness > tracking and there're enough cases like that that it pays off. Almost no applications use shared mmap writes to write to files. The error handling story is crap and there's only limited control about when writeback actually happens. Almost every application uses write(), even if they have the file mmaped. This isn't a scenario worth worrying about.