WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [PATCH v3 1/2] xen: add an "highmem" parameter to alloc_

To: stefano.stabellini@xxxxxxxxxxxxx
Subject: [Xen-devel] Re: [PATCH v3 1/2] xen: add an "highmem" parameter to alloc_xenballooned_pages
From: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Date: Wed, 07 Sep 2011 10:01:43 -0700
Cc: Ian.Campbell@xxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, konrad.wilk@xxxxxxxxxx
Delivery-date: Wed, 07 Sep 2011 10:04:51 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1315413571-10938-1-git-send-email-stefano.stabellini@xxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <alpine.DEB.2.00.1109071723470.12963@kaball-desktop> <1315413571-10938-1-git-send-email-stefano.stabellini@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0
On 09/07/2011 09:39 AM, stefano.stabellini@xxxxxxxxxxxxx wrote:
> From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
>
> Add an highmem parameter to alloc_xenballooned_pages, to allow callers to
> request lowmem or highmem pages.
>
> Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
> ---
>  drivers/xen/balloon.c |   12 ++++++++----
>  drivers/xen/gntdev.c  |    2 +-
>  include/xen/balloon.h |    3 ++-
>  3 files changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
> index 5dfd8f8..7f7d463 100644
> --- a/drivers/xen/balloon.c
> +++ b/drivers/xen/balloon.c
> @@ -501,20 +501,24 @@ EXPORT_SYMBOL_GPL(balloon_set_new_target);
>   * alloc_xenballooned_pages - get pages that have been ballooned out
>   * @nr_pages: Number of pages to get
>   * @pages: pages returned
> + * @highmem: highmem or lowmem pages
>   * @return 0 on success, error otherwise
>   */
> -int alloc_xenballooned_pages(int nr_pages, struct page** pages)
> +int alloc_xenballooned_pages(int nr_pages, struct page** pages, bool highmem)
>  {
>       int pgno = 0;
>       struct page* page;
>       mutex_lock(&balloon_mutex);
>       while (pgno < nr_pages) {
> -             page = balloon_retrieve(true);
> -             if (page) {
> +             page = balloon_retrieve(highmem);
> +             if (page && PageHighMem(page) == highmem) {
>                       pages[pgno++] = page;
>               } else {
>                       enum bp_state st;
> -                     st = decrease_reservation(nr_pages - pgno, 
> GFP_HIGHUSER);
> +                     if (page)
> +                             balloon_append(page);
> +                     st = decrease_reservation(nr_pages - pgno,
> +                                     highmem ? GFP_HIGHUSER : GFP_USER);
>                       if (st != BP_DONE)
>                               goto out_undo;
>               }
> diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
> index f914b26..07a56c2 100644
> --- a/drivers/xen/gntdev.c
> +++ b/drivers/xen/gntdev.c
> @@ -123,7 +123,7 @@ static struct grant_map *gntdev_alloc_map(struct 
> gntdev_priv *priv, int count)
>           NULL == add->pages)
>               goto err;
>  
> -     if (alloc_xenballooned_pages(count, add->pages))
> +     if (alloc_xenballooned_pages(count, add->pages, 0 /* lowmem */))

If the parameter is "bool" you should pass true/false.  But it might be
better to just make it take a GFP_ constant directly.

    J

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel