[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] mm: adjust get_page()'s types



Hi Jan,

On 16/09/2020 08:28, Jan Beulich wrote:
The passed in domain doesn't get altered and hence can be const. While
modifying its prototype anyway, also switch to bool.

Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx>

Cheers,

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -1560,17 +1560,17 @@ void put_page(struct page_info *page)
      }
  }
-int get_page(struct page_info *page, struct domain *domain)
+bool get_page(struct page_info *page, const struct domain *domain)
  {
-    struct domain *owner = page_get_owner_and_reference(page);
+    const struct domain *owner = page_get_owner_and_reference(page);
if ( likely(owner == domain) )
-        return 1;
+        return true;
if ( owner != NULL )
          put_page(page);
- return 0;
+    return false;
  }
/* Common code requires get_page_type and put_page_type.
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -2510,12 +2510,12 @@ struct domain *page_get_owner_and_refere
  }
-int get_page(struct page_info *page, struct domain *domain)
+bool get_page(struct page_info *page, const struct domain *domain)
  {
-    struct domain *owner = page_get_owner_and_reference(page);
+    const struct domain *owner = page_get_owner_and_reference(page);
if ( likely(owner == domain) )
-        return 1;
+        return true;
if ( !paging_mode_refcounts(domain) && !domain->is_dying )
          gprintk(XENLOG_INFO,
@@ -2526,7 +2526,7 @@ int get_page(struct page_info *page, str
      if ( owner )
          put_page(page);
- return 0;
+    return false;
  }
/*
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -151,7 +151,7 @@ TYPE_SAFE(unsigned long, pfn);
  struct page_info;
void put_page(struct page_info *);
-int get_page(struct page_info *, struct domain *);
+bool get_page(struct page_info *, const struct domain *);
  struct domain *__must_check page_get_owner_and_reference(struct page_info *);
/* Boot-time allocator. Turns into generic allocator after bootstrap. */


--
Julien Grall



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.