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

[Xen-changelog] [xen master] xen/memop: Latch current->domain in a local variable



commit f2c060fc972b1cb7aa7a1be35508a9ebfd564fdc
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Fri Aug 19 14:28:54 2016 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Fri Aug 19 18:39:48 2016 +0100

    xen/memop: Latch current->domain in a local variable
    
    It is more efficient.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/common/memory.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/common/memory.c b/xen/common/memory.c
index 812334b..1ead35c 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -864,7 +864,7 @@ static long xatp_permission_check(struct domain *d, 
unsigned int space)
 
 long do_memory_op(unsigned long cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 {
-    struct domain *d;
+    struct domain *d, *curr_d = current->domain;
     long rc;
     struct xen_memory_reservation reservation;
     struct memop_args args;
@@ -905,7 +905,7 @@ long do_memory_op(unsigned long cmd, 
XEN_GUEST_HANDLE_PARAM(void) arg)
              && (reservation.mem_flags & XENMEMF_populate_on_demand) )
             args.memflags |= MEMF_populate_on_demand;
 
-        if ( xsm_memory_adjust_reservation(XSM_TARGET, current->domain, d) )
+        if ( xsm_memory_adjust_reservation(XSM_TARGET, curr_d, d) )
         {
             rcu_unlock_domain(d);
             return start_extent;
@@ -962,7 +962,7 @@ long do_memory_op(unsigned long cmd, 
XEN_GUEST_HANDLE_PARAM(void) arg)
         if ( d == NULL )
             return -ESRCH;
 
-        rc = xsm_memory_stat_reservation(XSM_TARGET, current->domain, d);
+        rc = xsm_memory_stat_reservation(XSM_TARGET, curr_d, d);
         if ( rc )
         {
             rcu_unlock_domain(d);
@@ -1086,7 +1086,7 @@ long do_memory_op(unsigned long cmd, 
XEN_GUEST_HANDLE_PARAM(void) arg)
         if ( d == NULL )
             return -ESRCH;
 
-        rc = xsm_remove_from_physmap(XSM_TARGET, current->domain, d);
+        rc = xsm_remove_from_physmap(XSM_TARGET, curr_d, d);
         if ( rc )
         {
             rcu_unlock_domain(d);
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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