From mboxrd@z Thu Jan 1 00:00:00 1970 From: Akio Takebe Subject: Re: [PATCH] kvm balloon guest driver (v2) Date: Thu, 10 Jan 2008 21:27:37 +0900 Message-ID: References: <20080109181445.GA303@dmt> <20080110112902.GA6729@dmt> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel , Akio Takebe To: Marcelo Tosatti Return-path: In-Reply-To: <20080110112902.GA6729@dmt> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Hi, Marcelo >> >+static int kvm_balloon_inflate(struct virtballoon *v, int32_t npages) >> >+{ >> >+ LIST_HEAD(tmp_list); >> >+ struct page *page, *tmp; >> >+ struct balloon_buf *buf; >> >+ u32 *pfn; >> >+ int allocated = 0; >> >+ int i, r = -ENOMEM; >> >+ >> >+ buf = alloc_balloon_buf(v->vdev, GFP_KERNEL); >> When does balloon driver free the buf? > >Hi Akio, > >The buffers are passed from the virtio handling routine to the balloon_thread >through the balloon_work list, and then freed here: > >+ spin_lock_irq(&v->queue_lock); >+ while (!list_empty(&v->balloon_work)) { >+ struct balloon_work *work; >+ struct balloon_buf *buf; >+ >+ work = list_entry(v->balloon_work.next, >+ struct balloon_work, list); >+ list_del(&work->list); >+ spin_unlock_irq(&v->queue_lock); >+ buf = work->buf; >+ kfree(work); >+ >+ switch(buf->hdr.cmd) { >+ case CMD_BALLOON_DEFLATE: >+ deflate_done(v, buf); >+ break; >+ case CMD_BALLOON_INFLATE: >+ inflate_done(v, buf); >+ break; >+ default: >+ printk("%s: unknown cmd 0x%x\n", __func__, >+ buf->hdr.cmd); >+ } >+ kfree(buf); Thank you for your exlanation. Does balloon free the buf when kvm_balloon_xflate() retrun -ENOMEM? Best Regards, Akio Takebe ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace