On Thu, Sep 12, 2013 at 06:01:37PM -0500, Alexander Graf wrote: > > On 05.08.2013, at 23:27, Paul Mackerras wrote: > > > Currently we request write access to all pages that get mapped into the > > guest, even if the guest is only loading from the page. This reduces > > the effectiveness of KSM because it means that we unshare every page we > > access. Also, we always set the changed (C) bit in the guest HPTE if > > it allows writing, even for a guest load. > > Have you measured how much performance we lose by mapping it twice? Usually Linux will mark user pages that are not written to yet as non-writable, no? That's why I assumed that "may_write" is the same as "guest wants to write" back when I wrote this. > > I'm also afraid that a sequence like > > ld x,y > std x,y > > in the kernel will trap twice and slow us down heavily. But maybe I'm just being paranoid. Can you please measure bootup time with and without this, as well as a fork bomb (spawn /bin/echo 1000 times and time it) with and without so we get a feeling for its impact? Bootup (F19 guest, 3 runs): Without the patch: average 20.12 seconds, st. dev. 0.17 seconds With the patch: 20.47 seconds, st. dev. 0.19 seconds Delta: 0.35 seconds, or 1.7%. time for i in $(seq 1000); do /bin/echo $i >/dev/null; done: Without the patch: average 7.27 seconds, st. dev. 0.23 seconds With the patch: average 7.55 seconds, st. dev. 0.39 seconds Delta: 0.28 seconds, or 3.8%. So there appears to be a small effect, of a few percent. Paul. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html