]> xenbits.xensource.com Git - people/liuw/xen.git/commitdiff
make domain_adjust_tot_pages() __must_check
authorJan Beulich <jbeulich@suse.com>
Thu, 6 Dec 2018 11:19:04 +0000 (12:19 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 6 Dec 2018 11:19:04 +0000 (12:19 +0100)
Even if unlikely, donate_page() should not ignore the possible need to
obtain a domain reference. To make people look more closely when they
add new uses of domain_adjust_tot_pages(), force its return value to be
checked. This in turn requires a benign change to assign_pages().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/mm.c
xen/common/page_alloc.c
xen/include/xen/mm.h

index 28a003063e70fb0c1ece499914a6e583f4d6f8db..b3350eee35b57f173fdad34082750aa32f85f7b3 100644 (file)
@@ -4009,7 +4009,8 @@ int donate_page(
     {
         if ( d->tot_pages >= d->max_pages )
             goto fail;
-        domain_adjust_tot_pages(d, 1);
+        if ( unlikely(domain_adjust_tot_pages(d, 1) == 1) )
+            get_knownalive_domain(d);
     }
 
     page->count_info = PGC_allocated | 1;
index fd3b0aaa8351bc31e03905533b9fdf18f99f4ef5..b314b5cee8a4d598d3950f65d4f64b82cb24cac9 100644 (file)
@@ -2273,10 +2273,8 @@ int assign_pages(
             goto out;
         }
 
-        if ( unlikely(d->tot_pages == 0) )
+        if ( unlikely(domain_adjust_tot_pages(d, 1 << order) == (1 << order)) )
             get_knownalive_domain(d);
-
-        domain_adjust_tot_pages(d, 1 << order);
     }
 
     for ( i = 0; i < (1 << order); i++ )
index 054d02e6c0e68b411afba42424dc5fe7e7d69855..e9711472343c8452824fcff8066a3e88379691f1 100644 (file)
@@ -190,7 +190,8 @@ int destroy_xen_mappings(unsigned long v, unsigned long e);
  */
 int populate_pt_range(unsigned long virt, unsigned long nr_mfns);
 /* Claim handling */
-unsigned long domain_adjust_tot_pages(struct domain *d, long pages);
+unsigned long __must_check domain_adjust_tot_pages(struct domain *d,
+    long pages);
 int domain_set_outstanding_pages(struct domain *d, unsigned long pages);
 void get_outstanding_claims(uint64_t *free_pages, uint64_t *outstanding_pages);