From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: madvise() not triggering page discard with MMU-notifiers Date: Thu, 28 Aug 2008 17:55:34 -0500 Message-ID: <48B72CE6.9070306@us.ibm.com> References: <48A9F1E9.6040907@us.ibm.com> <20080828142356.GA19754@duo.random> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Avi Kivity , Marcelo Tosatti , kvm-devel To: Andrea Arcangeli Return-path: Received: from e33.co.us.ibm.com ([32.97.110.151]:48483 "EHLO e33.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752376AbYH1W4W (ORCPT ); Thu, 28 Aug 2008 18:56:22 -0400 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e33.co.us.ibm.com (8.13.8/8.13.8) with ESMTP id m7SMuMpW024537 for ; Thu, 28 Aug 2008 18:56:22 -0400 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.0) with ESMTP id m7SMuMv3194244 for ; Thu, 28 Aug 2008 16:56:22 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m7SMuL1g017409 for ; Thu, 28 Aug 2008 16:56:21 -0600 In-Reply-To: <20080828142356.GA19754@duo.random> Sender: kvm-owner@vger.kernel.org List-ID: Andrea Arcangeli wrote: > On Mon, Aug 18, 2008 at 05:04:25PM -0500, Anthony Liguori wrote: > >> + if (!kvm_enabled() || !qemu_kvm_has_mmu_notifiers()) >> + madvise(addr, TARGET_PAGE_SIZE, >> + deflate ? MADV_WILLNEED : MADV_DONTNEED); >> > > The check was reversed so madvise wasn't invoked in the first place if > mmu notifier was enabled in the host kernel. This should fix it > (untested): > > if (!kvm_enabled() || kvm_has_sync_mmu()) > Ugh, sorry about that Andrea. I've sent out an updated patch set. With MMU notifiers, ballooning is working exactly as expected. Regards, Anthony Liguori