Re: [PATCH v1 1/1] mm/ksm: improve deduplication of zero pages with colouring

From: Andrea Arcangeli
Date: Wed Jan 18 2017 - 13:13:41 EST


On Wed, Jan 18, 2017 at 06:17:09PM +0100, Claudio Imbrenda wrote:
> That's true. As I said above, my previous example was not very well
> thought. The more realistic scenario is that of having the colored zero
> pages of a guest merged.

That's a good point for making a special case that retains the
coloring of those guest pages, agreed.

Retaining the coloring of guest zero pages is however a different
"feature" than what KSM was supposed to run for though, I mean the
guest may run faster with KSM than without because without KSM you
wouldn't know which host physical page is allocated for each guest
zero page. If you wanted top performance then you wouldn't know if to
enable KSM or not.

I wonder if the zero page coloring would be better solved with a
vhost-zeropage dedicated mechanism that would be always enabled
regardless if KSM is enabled or not. KSM is generally a CPU vs memory
tradeoff, and it's in general good idea to enable it.

It's also ok if KSM improves performance of course, definitely not
forbidden in fact it's ideal, but my point is, the rest of KSM might
decrease performance too, so if you need a top-performance setup for
benchmarks or for some special usage, it'd be hard to decide if to
enable KSM or not on those archs requiring page coloring.

Thanks,
Andrea