From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrea Arcangeli Subject: Re: madvise() not triggering page discard with MMU-notifiers Date: Thu, 28 Aug 2008 16:23:56 +0200 Message-ID: <20080828142356.GA19754@duo.random> References: <48A9F1E9.6040907@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Avi Kivity , Marcelo Tosatti , kvm-devel To: Anthony Liguori Return-path: Received: from host36-195-149-62.serverdedicati.aruba.it ([62.149.195.36]:48970 "EHLO mx.cpushare.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752673AbYH1OYF (ORCPT ); Thu, 28 Aug 2008 10:24:05 -0400 Content-Disposition: inline In-Reply-To: <48A9F1E9.6040907@us.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: 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())