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

Re: [win-pv-devel] [PATCH 2/3] Move balloon failure conditions to Inflate/Deflate calls



> -----Original Message-----
> From: win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx [mailto:win-pv-devel-
> bounces@xxxxxxxxxxxxxxxxxxxx] On Behalf Of Owen Smith
> Sent: 15 December 2015 11:30
> To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Owen Smith
> Subject: [win-pv-devel] [PATCH 2/3] Move balloon failure conditions to
> Inflate/Deflate calls
> 
> Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
> ---
>  src/xenbus/balloon.c | 53 ++++++++++++++++++++++++++++----------------
> --------
>  1 file changed, 29 insertions(+), 24 deletions(-)
> 
> diff --git a/src/xenbus/balloon.c b/src/xenbus/balloon.c
> index e697722..e2ce8de 100644
> --- a/src/xenbus/balloon.c
> +++ b/src/xenbus/balloon.c
> @@ -572,6 +572,25 @@ done:
>  }
> 
>  static BOOLEAN
> +BalloonLowMemory(
> +    IN  PXENBUS_BALLOON_CONTEXT Context
> +    )
> +{
> +    LARGE_INTEGER               Timeout;
> +    NTSTATUS                    status;
> +
> +    Timeout.QuadPart = 0;
> +
> +    status = KeWaitForSingleObject(Context->LowMemoryEvent,
> +                                   Executive,
> +                                   KernelMode,
> +                                   FALSE,
> +                                   &Timeout);
> +
> +    return (status == STATUS_SUCCESS) ? TRUE : FALSE;
> +}
> +
> +static BOOLEAN
>  BalloonDeflate(
>      IN  PXENBUS_BALLOON_CONTEXT Context,
>      IN  ULONGLONG               Requested
> @@ -583,6 +602,9 @@ BalloonDeflate(
>      ULONGLONG                   Count;
>      ULONGLONG                   TimeDelta;
> 
> +    if (Context->FIST.Deflation)
> +        return TRUE;
> +
>      Info("====> %llu page(s)\n", Requested);
> 
>      KeQuerySystemTime(&Start);
> @@ -627,6 +649,11 @@ BalloonInflate(
>      ULONGLONG                   Count;
>      ULONGLONG                   TimeDelta;
> 
> +    if (Context->FIST.Inflation)
> +        return TRUE;
> +    if (BalloonLowMemory(Context))
> +        return TRUE;
> +

I think these conditions can just be ||ed together into a single if. I'll do 
that when I commit.

Acked-by: Paul Durrant <paul.durrant@xxxxxxxxxx>

>      Info("====> %llu page(s)\n", Requested);
> 
>      KeQuerySystemTime(&Start);
> @@ -673,25 +700,6 @@ BalloonInflate(
>      return Abort;
>  }
> 
> -static BOOLEAN
> -BalloonLowMemory(
> -    IN  PXENBUS_BALLOON_CONTEXT Context
> -    )
> -{
> -    LARGE_INTEGER               Timeout;
> -    NTSTATUS                    status;
> -
> -    Timeout.QuadPart = 0;
> -
> -    status = KeWaitForSingleObject(Context->LowMemoryEvent,
> -                                   Executive,
> -                                   KernelMode,
> -                                   FALSE,
> -                                   &Timeout);
> -
> -    return (status == STATUS_SUCCESS) ? TRUE : FALSE;
> -}
> -
>  static VOID
>  BalloonGetFISTEntries(
>      IN  PXENBUS_BALLOON_CONTEXT Context
> @@ -758,12 +766,9 @@ BalloonAdjust(
> 
>      while (Context->Size != Size && !Abort) {
>          if (Size > Context->Size)
> -            Abort = Context->FIST.Inflation ||
> -                    BalloonLowMemory(Context) ||
> -                    BalloonInflate(Context, Size - Context->Size);
> +            Abort = BalloonInflate(Context, Size - Context->Size);
>          else if (Size < Context->Size)
> -            Abort = Context->FIST.Deflation ||
> -                    BalloonDeflate(Context, Context->Size - Size);
> +            Abort = BalloonDeflate(Context, Context->Size - Size);
>      }
> 
>      Info("<==== (%llu page(s))%s\n",
> --
> 1.9.4.msysgit.1
> 
> 
> _______________________________________________
> win-pv-devel mailing list
> win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel

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


 


Rackspace

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