From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=40327 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PaZRM-0008Mj-Rp for qemu-devel@nongnu.org; Wed, 05 Jan 2011 14:54:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PaZRL-0008UR-QY for qemu-devel@nongnu.org; Wed, 05 Jan 2011 14:54:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51090) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PaZRL-0008UG-Jl for qemu-devel@nongnu.org; Wed, 05 Jan 2011 14:54:35 -0500 Date: Wed, 5 Jan 2011 20:54:30 +0100 From: Andrea Arcangeli Subject: Re: [Qemu-devel] [PATCH] add MADV_DONTFORK to guest physical memory Message-ID: <20110105195430.GF15823@random.random> References: <20100915170824.GL5981@random.random> <20110105151012.GC15823@random.random> <4D24B22C.4010302@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: Blue Swirl , Andreas =?iso-8859-1?Q?F=E4rber?= , "qemu-devel@nongnu.org Developers" , Michael Roth , Anthony Liguori Hello everyone, On Wed, Jan 05, 2011 at 08:44:38PM +0100, Alexander Graf wrote: > > On 05.01.2011, at 19:02, Michael Roth wrote: > > > On 01/05/2011 09:10 AM, Andrea Arcangeli wrote: > >> The bug is still there so I rediffed the old patch against current > >> code. > >> > >> On a related topic: could somebody give me advice on how to implement > >> a command line (command line seems enough, the other option would be > >> monitor command) to make the MADV_MERGEABLE conditional? I got KSM on > >> THP working fine but KSM may decrease performance by increasing the > >> number of copy on write and by splitting hugepages, so we'd like to be > >> able to turn off KSM on a per-VM basis (not on the whole host, which > >> of course we already can by setting /sys/kernel/mm/ksm/run to 0) so > >> that high perf VMs will keep running at maximum speed with KSM off but > >> others may still benefit from KSM. For that I need to make the below > >> MADV_MERGEABLE madvise conditional to something and the code itself > >> will be trivial, we've just to converge on a command line option > >> (hopefully quickly ;). > > > > There was a -mem_prealloc option added a while back to set MAP_POPULATE on memory mapped in via the -mem-path option. So an analogous -mem_nomerge option or something along that line seems reasonable for conditionally unsetting QEMU_MADV_MERGEABLE. > > > > And for consistency you should probably make both your proposed changes for -mem-path'd memory as well. > > Why not clean up all that mess and introduce a new -mem option that would just take all of the several options as parameters? > > -mem size=512,populate=on,ksm=off > > and default -m to something reasonable with the new syntax. I'm neutral... so feel free to decide what I should implement ;). One comment on combining -m ksm=off (or -mem_nomerge) with -mem-path. It seems unnecessary because ksm can't be turned on on VM_HUGETLB vmas (MADV_MERGEABLE will return -EINVAL) and mem-path only makes sense if used in combination with hugetlbfs (which sets VM_HUGETLB of course).