From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jes Sorensen Subject: Re: KSM For All Via LD_PRELOAD? Date: Thu, 10 Jun 2010 09:44:50 +0200 Message-ID: <4C1097F2.8070802@redhat.com> References: <4C0E8F3B.5060501@bobich.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Gordan Bobic Return-path: Received: from mx1.redhat.com ([209.132.183.28]:41651 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752559Ab0FJHpM (ORCPT ); Thu, 10 Jun 2010 03:45:12 -0400 In-Reply-To: <4C0E8F3B.5060501@bobich.net> Sender: kvm-owner@vger.kernel.org List-ID: On 06/08/10 20:43, Gordan Bobic wrote: > Is this plausible? > > I'm trying to work out if it's even worth considering this approach to > enable all memory used by in a system to be open to KSM page merging, > rather than only memory used by specific programs aware of it (e.g. > kvm/qemu). > > Something like this would address the fact that container based > virtualization (OpenVZ, VServer, LXC) cannot benefit from KSM. > > What I'm thinking about is somehow intercepting malloc() and wrapping it > so that all malloc()-ed memory gets madvise()-d as well. Not sure if it is worth it, but you might want to look at ElectricFence which does malloc wrapping in a somewhat similar way. It might save you some code :) Whether or not you will run into problems if you run it system wise is really hard to predict. Any other application that might be linked in a special way or use preload itself might bark, but you can try it out and see what explodes. Cheers, Jes