[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [XENBUS PATCH 2/4] balloon: Remove allocation/deallocation wrappers
BalloonPopulatePhysmap and BalloonDecreaseReservation only measure the time taken by the corresponding Memory* functions, but that's already done in BalloonPopulatePfnArray/BalloonReleasePfnArray (among other places). Remove these functions to simplify the code. Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx> --- src/xenbus/balloon.c | 80 +++++--------------------------------------- 1 file changed, 8 insertions(+), 72 deletions(-) diff --git a/src/xenbus/balloon.c b/src/xenbus/balloon.c index fb4fceb..2b657ce 100644 --- a/src/xenbus/balloon.c +++ b/src/xenbus/balloon.c @@ -369,41 +369,6 @@ done: return Count; } -static NTSTATUS -BalloonPopulatePhysmap( - _In_ ULONG Requested, - _In_ PPFN_NUMBER PfnArray, - _Out_ PULONG Populated - ) -{ - LARGE_INTEGER Start; - LARGE_INTEGER End; - ULONGLONG TimeDelta; - ULONGLONG Rate; - ULONG Count; - NTSTATUS status; - - ASSERT(Requested != 0); - - KeQuerySystemTime(&Start); - - status = MemoryPopulatePhysmap(PAGE_ORDER_4K, - Requested, - PfnArray, - &Count); - if (!NT_SUCCESS(status)) - return status; - - KeQuerySystemTime(&End); - TimeDelta = __max(((End.QuadPart - Start.QuadPart) / 10000ull), 1); - - Rate = (ULONGLONG)(Count * 1000) / TimeDelta; - - Info("%u page(s) at %llu pages/s\n", Count, Rate); - *Populated = Count; - return STATUS_SUCCESS; -} - static ULONG BalloonPopulatePfnArray( _In_ PXENBUS_BALLOON_CONTEXT Context, @@ -437,7 +402,10 @@ BalloonPopulatePfnArray( Context->PfnArray[Index] = (PFN_NUMBER)Pfn; } - status = BalloonPopulatePhysmap(Requested, Context->PfnArray, &Count); + status = MemoryPopulatePhysmap(PAGE_ORDER_4K, + Requested, + Context->PfnArray, + &Count); if (!NT_SUCCESS(status)) Count = 0; @@ -464,41 +432,6 @@ BalloonPopulatePfnArray( return Count; } -static NTSTATUS -BalloonDecreaseReservation( - _In_ ULONG Requested, - _In_ PPFN_NUMBER PfnArray, - _Out_ PULONG Decreased - ) -{ - LARGE_INTEGER Start; - LARGE_INTEGER End; - ULONGLONG TimeDelta; - ULONGLONG Rate; - ULONG Count; - NTSTATUS status; - - ASSERT(Requested != 0); - - KeQuerySystemTime(&Start); - - status = MemoryDecreaseReservation(PAGE_ORDER_4K, - Requested, - PfnArray, - &Count); - if (!NT_SUCCESS(status)) - return status; - - KeQuerySystemTime(&End); - TimeDelta = __max(((End.QuadPart - Start.QuadPart) / 10000ull), 1); - - Rate = (ULONGLONG)(Count * 1000) / TimeDelta; - - Info("%u page(s) at %llu pages/s\n", Count, Rate); - *Decreased = Count; - return STATUS_SUCCESS; -} - static ULONG BalloonReleasePfnArray( _In_ PXENBUS_BALLOON_CONTEXT Context, @@ -535,7 +468,10 @@ BalloonReleasePfnArray( } Requested = Index; - status = BalloonDecreaseReservation(Requested, Context->PfnArray, &Count); + status = MemoryDecreaseReservation(PAGE_ORDER_4K, + Requested, + Context->PfnArray, + &Count); if (!NT_SUCCESS(status)) Count = 0; -- 2.50.1.windows.1 Ngoc Tu Dinh | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |