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

[Xen-devel] [PATCH 1/2] xen/memop: Latch current->domain in a local variable



It is more efficient.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: George Dunlap <George.Dunlap@xxxxxxxxxxxxx>
---
 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);
-- 
2.1.4


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

 


Rackspace

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