From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Brook Subject: Re: [5874] Add virtio-balloon support Date: Fri, 5 Dec 2008 14:14:37 +0000 Message-ID: <200812051414.38406.paul@codesourcery.com> References: <1228426490.19459.44.camel@localhost.localdomain> <49385B02.9010206@codemonkey.ws> Reply-To: qemu-devel@nongnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Cc: Rusty Russell , Hollis Blanchard , kvm-devel To: qemu-devel@nongnu.org Return-path: In-Reply-To: <49385B02.9010206@codemonkey.ws> Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org List-Id: kvm.vger.kernel.org On Thursday 04 December 2008, Anthony Liguori wrote: > Hollis Blanchard wrote: > > On Thu, 2008-12-04 at 20:33 +0000, Anthony Liguori wrote: > >> +static void balloon_page(void *addr, int deflate) > >> +{ > >> +#if defined(__linux__) > >> + if (!kvm_enabled() || kvm_has_sync_mmu()) > >> + madvise(addr, TARGET_PAGE_SIZE, > >> + deflate ? MADV_WILLNEED : MADV_DONTNEED); > >> +#endif > >> +} > > > > Hmm, I just noticed this... we need to use VIRTIO_BALLOON_PFN_SHIFT like > > Rusty did on the kernel side. > > > > However, in general I'm not sure how this is supposed to work. Isn't it > > true that madvise() is a no-op if 0 < length < getpagesize()? If so, how > > should the guest know the chunk size needed on the host? > > We need to pass multiple of TARGET_PAGE_SIZE to madvise() You mean HOST_PAGE_SIZE? My linux manpage says that the address must be page aligned. Paul