[linux-mm-cc] I guess you have been following ksm.

Peter Dolding oiaohm at gmail.com
Sun Apr 19 06:28:33 EDT 2009


On Sun, Apr 19, 2009 at 3:12 PM, John McCabe-Dansted <gmatht at gmail.com> wrote:
> On Fri, Apr 17, 2009 at 2:45 PM, Nitin Gupta <ngupta at vflare.org> wrote:
>> On Fri, Apr 17, 2009 at 4:02 AM, Peter Dolding <oiaohm at gmail.com> wrote:
>>> The copy on write system also appears to provide something else
>>> interesting.  ksm and compcache are both after allocation.   The
>>> interesting question is if Linux kernel should provide a calloc
>>> function.   So that on commit its is automatically stacked.  This
>>> would massively reduce the numbers of blank matching pages.  Linux
>>> system already has something that deals with malloc allowing over
>>> commits until accessed.
>>>
>>
>> Not sure if I understand you here. You mean all new allocation should
>> be zeroed to play better with KSM?
>
> Not sure either, but it seems similar to my suggestion that we could
> use existing techniques to zero garbage. The suggested purpose of
> these techniqueswas security, but this would presumably also improve
> the compression ratio of compcache.  Apparently they require only ~1%
> overhead and we may be able to do even better that this if the goal is
> performance rather than security
> http://www.usenix.org/events/sec05/tech/full_papers/chow/chow_html/index.html
>
> Unfortunately they have lost the code, so we would have to reimplement
> it from scratch.
>
I had not though of the secuirty side.  Using copy on write side of
the Linux kernel for memory allocation in the same way ksm stacks
pages does not prevent memory from containing data.  Just makes direct
access harder.   copy on write will overwrite the free memory block
before application gets access to it.

Now chow idea costs.   chow is a simple glibc alteration.  Deallocate
Fill with zeros.  Path I am looking at is ksm.  Deallocate remove from
direct access until a copy on write operation is performed on the
memory block.

Different method different costs.  Zeroing takes cpu time.  Allocating
pages require connecting pages anyhow.   Returning page to dirty stack
of pages to be over writen and pointing page to a zeroed copy on write
page.

Cost of zeroing was the downside to chow with any other gains other
than secuirty.  Zeroing by page merging gains memory as well as
secuirty.

Peter Dolding


More information about the linux-mm-cc mailing list