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

[win-pv-devel] [PATCH xenbus 1/3] Add Order parameter to MemoryDecreaseReservation()...



...and MemoryPopulatePhysmap()

Stop hard-coding the page order to 0 and allow the caller to specify it.
Also add a couple of #defines for 4k and 2M page orders.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 include/xen.h        |  5 +++++
 src/xen/memory.c     |  6 ++++--
 src/xenbus/balloon.c | 24 ++++++++++++------------
 3 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/include/xen.h b/include/xen.h
index e7956f0..98b0748 100644
--- a/include/xen.h
+++ b/include/xen.h
@@ -126,10 +126,14 @@ MemoryAddToPhysmap(
     IN  ULONG_PTR   Offset
     );
 
+#define PAGE_ORDER_4K   0
+#define PAGE_ORDER_2M   9
+
 __checkReturn
 XEN_API
 ULONG
 MemoryDecreaseReservation(
+    IN  ULONG       Order,
     IN  ULONG       Count,
     IN  PPFN_NUMBER PfnArray
     );
@@ -138,6 +142,7 @@ __checkReturn
 XEN_API
 ULONG
 MemoryPopulatePhysmap(
+    IN  ULONG       Order,
     IN  ULONG       Count,
     IN  PPFN_NUMBER PfnArray
     );
diff --git a/src/xen/memory.c b/src/xen/memory.c
index 9b555ec..5cdbe9d 100644
--- a/src/xen/memory.c
+++ b/src/xen/memory.c
@@ -84,6 +84,7 @@ __checkReturn
 XEN_API
 ULONG
 MemoryDecreaseReservation(
+    IN  ULONG                       Order,
     IN  ULONG                       Count,
     IN  PPFN_NUMBER                 PfnArray
     )
@@ -92,7 +93,7 @@ MemoryDecreaseReservation(
     LONG_PTR                        rc;
 
     set_xen_guest_handle(op.extent_start, PfnArray);
-    op.extent_order = 0;
+    op.extent_order = Order;
     op.mem_flags = 0;
     op.domid = DOMID_SELF;
     op.nr_extents = Count;
@@ -106,6 +107,7 @@ __checkReturn
 XEN_API
 ULONG
 MemoryPopulatePhysmap(
+    IN  ULONG                       Order,
     IN  ULONG                       Count,
     IN  PPFN_NUMBER                 PfnArray
     )
@@ -114,7 +116,7 @@ MemoryPopulatePhysmap(
     LONG_PTR                        rc;
 
     set_xen_guest_handle(op.extent_start, PfnArray);
-    op.extent_order = 0;
+    op.extent_order = Order;
     op.mem_flags = 0;
     op.domid = DOMID_SELF;
     op.nr_extents = Count;
diff --git a/src/xenbus/balloon.c b/src/xenbus/balloon.c
index f987096..6f3767c 100644
--- a/src/xenbus/balloon.c
+++ b/src/xenbus/balloon.c
@@ -340,17 +340,17 @@ BalloonPopulatePhysmap(
     IN  PPFN_NUMBER PfnArray
     )
 {
-    LARGE_INTEGER           Start;
-    LARGE_INTEGER           End;
-    ULONGLONG               TimeDelta;
-    ULONGLONG               Rate;
-    ULONG                   Count;
+    LARGE_INTEGER   Start;
+    LARGE_INTEGER   End;
+    ULONGLONG       TimeDelta;
+    ULONGLONG       Rate;
+    ULONG           Count;
 
     ASSERT(Requested != 0);
 
     KeQuerySystemTime(&Start);
 
-    Count = MemoryPopulatePhysmap(Requested, PfnArray);
+    Count = MemoryPopulatePhysmap(Requested, PAGE_ORDER_4K, PfnArray);
 
     KeQuerySystemTime(&End);
     TimeDelta = __max(((End.QuadPart - Start.QuadPart) / 10000ull), 1);
@@ -427,17 +427,17 @@ BalloonDecreaseReservation(
     IN  PPFN_NUMBER PfnArray
     )
 {
-    LARGE_INTEGER           Start;
-    LARGE_INTEGER           End;
-    ULONGLONG               TimeDelta;
-    ULONGLONG               Rate;
-    ULONG                   Count;
+    LARGE_INTEGER   Start;
+    LARGE_INTEGER   End;
+    ULONGLONG       TimeDelta;
+    ULONGLONG       Rate;
+    ULONG           Count;
 
     ASSERT(Requested != 0);
 
     KeQuerySystemTime(&Start);
 
-    Count = MemoryDecreaseReservation(Requested, PfnArray);
+    Count = MemoryDecreaseReservation(Requested, PAGE_ORDER_4K, PfnArray);
 
     KeQuerySystemTime(&End);
     TimeDelta = __max(((End.QuadPart - Start.QuadPart) / 10000ull), 1);
-- 
2.5.3


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/win-pv-devel

 


Rackspace

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