[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120830085724.GF10269@redhat.com>
Date: Thu, 30 Aug 2012 11:57:24 +0300
From: "Michael S. Tsirkin" <mst@...hat.com>
To: Frank Swiderski <fes@...gle.com>
Cc: Rusty Russell <rusty@...tcorp.com.au>, riel@...hat.com,
Andrea Arcangeli <aarcange@...hat.com>,
virtualization@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org, mikew@...gle.com
Subject: Re: [PATCH] Add a page cache-backed balloon device driver.
On Tue, Jun 26, 2012 at 01:32:58PM -0700, Frank Swiderski wrote:
> +static void fill_balloon(struct virtio_balloon *vb, size_t num)
> +{
> + int err;
> +
> + /* We can only do one array worth at a time. */
> + num = min(num, ARRAY_SIZE(vb->pfns));
> +
> + for (vb->num_pfns = 0; vb->num_pfns < num; vb->num_pfns++) {
> + struct page *page;
> + unsigned long inode_pfn = find_available_inode_page(vb);
> + /* Should always be able to find a page. */
> + BUG_ON(!inode_pfn);
> + page = read_mapping_page(the_inode.inode.i_mapping, inode_pfn,
> + NULL);
> + if (IS_ERR(page)) {
> + if (printk_ratelimit())
> + dev_printk(KERN_INFO, &vb->vdev->dev,
> + "Out of puff! Can't get %zu pages\n",
> + num);
> + break;
> + }
> +
> + /* Set the page to be dirty */
> + set_page_dirty(page);
> +
> + vb->pfns[vb->num_pfns] = page_to_pfn(page);
> + }
> +
> + /* Didn't get any? Oh well. */
> + if (vb->num_pfns == 0)
> + return;
Went to look at this driver, and noticed caller will re-invoke
this immediately if this triggers, so we busy-wait
re-trying this. When does read_mapping_page fail?
Is there any condition we could wait on?
--
MST
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists