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

[xen staging] memory: avoid pointless continuation in xenmem_add_to_physmap()



commit d9751646697b1e2d337990264068ead3c10b993a
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Jan 14 13:00:26 2021 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Jan 14 13:00:26 2021 +0100

    memory: avoid pointless continuation in xenmem_add_to_physmap()
    
    Adjust so we uniformly avoid needlessly arranging for a continuation on
    the last iteration.
    
    Fixes: 5777a3742d88 ("IOMMU: hold page ref until after deferred TLB flush")
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Julien Grall <jgrall@xxxxxxxxxx>
---
 xen/common/memory.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index b21b6c452d..ccb4d49fc6 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -858,8 +858,9 @@ int xenmem_add_to_physmap(struct domain *d, struct 
xen_add_to_physmap *xatp,
             ++extra.ppage;
 
         /* Check for continuation if it's not the last iteration. */
-        if ( (++done >= ARRAY_SIZE(pages) && extra.ppage) ||
-             (xatp->size > done && hypercall_preempt_check()) )
+        if ( xatp->size > ++done &&
+             ((done >= ARRAY_SIZE(pages) && extra.ppage) ||
+              hypercall_preempt_check()) )
         {
             rc = start + done;
             break;
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

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