Re: [PATCH v4 0/3] Sanitizing freed pages

From: Anisse Astier
Date: Wed May 20 2015 - 08:24:40 EST


On Tue, May 19, 2015 at 2:46 PM, Mel Gorman <mgorman@xxxxxxx> wrote:
> On Thu, May 14, 2015 at 04:19:45PM +0200, Anisse Astier wrote:
>> Hi,
>>
>> - it can help with long-term memory consumption in an environment with
>> multiple VMs and Kernel Same-page Merging on the host. [2]
>
> This is not quantified but a better way of dealing with that problem would
> be for a guest to signal to the host when a page is really free. I vaguely
> recall that s390 has some hinting of this nature. While I accept there
> may be some benefits in some cases, I think it's a weak justification for
> always zeroing pages on free.

Sure, there's always a better way, like virtio's ballooning. This
approach has the merit of being much simpler to use.



>> I haven't been able to measure a meaningful performance difference when
>> compiling a (in-cache) kernel; I'd be interested to see what difference it
>> makes with your particular workload/hardware (I suspect mine is CPU-bound on
>> this small laptop).
>>
>
> What did you use to determine this and did you check if it was hitting
> the free paths heavily while it's running? It can be very easy to hide
> the cost of something like this if all the frees happen at exit.

I'll admit that it's lacking numbers; I've chosen the simplest
benchmark available (kernel compiles), and couldn't measure a
difference in overall time, but I didn't go as far as using perf to
find where the hot path is.

Another way of thinking about this is just moving the clearing from
allocation to freeing. Userland memory allocated through anonymous
mapping is already cleared on alloc, so this will make allocation
faster. It's a different kind of tradeoff.

Regards,

Anisse
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/