On Fri, Aug 18, 2023, Yan Zhao wrote: > On Thu, Aug 17, 2023 at 10:53:25AM -0700, Sean Christopherson wrote: > > And FWIW, removing .change_pte() entirely, even without any other optimizations, > > will also benefit those guests, as it will remove a source of mmu_lock contention > > along with all of the overhead of invoking callbacks, walking memslots, etc. And > > removing .change_pte() will benefit *all* guests by eliminating unrelated callbacks, > > i.e. callbacks when memory for the VMM takes a CoW fault. > > > If with above "always write_fault = true" solution, I think it's better. Another option would be to allow a per-mm override of use_zero_page, but I think I like the KVM memslot route more as it provides better granularity, doesn't prevent CoW for VMM memory, and works even if THP isn't being used.