xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xenpaging: use poll timeout if no paging target exists
@ 2012-08-28  8:32 Olaf Hering
  2012-09-07 16:05 ` Ian Campbell
  0 siblings, 1 reply; 4+ messages in thread
From: Olaf Hering @ 2012-08-28  8:32 UTC (permalink / raw)
  To: xen-devel

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1346142745 -7200
# Node ID b088e473c7fb1a47b9578693c1750cd27767cc25
# Parent  03ef29089830b119b6efd87db8ab5c38b7428938
xenpaging: use poll timeout if no paging target exists

Currently xenpaging will use 100% cpu time if a paging target is not yet
set via xenstore. The reason is that ->use_poll_timeout is initialized
to zero. Another case is when the paging target is set to zero. In this
case ->use_poll_timeout will not be set to 1.

Fix the first case by initializing use_poll_timeout to 1 in
xenpaging_init. The second case is fixed by setting use_poll_timeout in
case the target is zero and there are no more pages left to resume.

Signed-off-by: Olaf Hering <olaf@aepfle.de>

diff -r 03ef29089830 -r b088e473c7fb tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c
+++ b/tools/xenpaging/xenpaging.c
@@ -482,6 +482,9 @@ static struct xenpaging *xenpaging_init(
         goto err;
     }
 
+    /* Use a poll timeout until xenpaging got a target from xenstore */
+    paging->use_poll_timeout = 1;
+
     return paging;
 
  err:
@@ -1019,6 +1022,8 @@ int main(int argc, char *argv[])
         {
             if ( paging->num_paged_out )
                 resume_pages(paging, paging->num_paged_out);
+            else
+                paging->use_poll_timeout = 1;
         }
         /* Evict more pages if target not reached */
         else if ( tot_pages > paging->target_tot_pages )

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xenpaging: use poll timeout if no paging target exists
  2012-08-28  8:32 [PATCH] xenpaging: use poll timeout if no paging target exists Olaf Hering
@ 2012-09-07 16:05 ` Ian Campbell
  2012-09-07 16:14   ` Olaf Hering
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Campbell @ 2012-09-07 16:05 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel@lists.xen.org

On Tue, 2012-08-28 at 09:32 +0100, Olaf Hering wrote:
> # HG changeset patch
> # User Olaf Hering <olaf@aepfle.de>
> # Date 1346142745 -7200
> # Node ID b088e473c7fb1a47b9578693c1750cd27767cc25
> # Parent  03ef29089830b119b6efd87db8ab5c38b7428938
> xenpaging: use poll timeout if no paging target exists
> 
> Currently xenpaging will use 100% cpu time if a paging target is not yet
> set via xenstore. The reason is that ->use_poll_timeout is initialized
> to zero. Another case is when the paging target is set to zero. In this
> case ->use_poll_timeout will not be set to 1.
> 
> Fix the first case by initializing use_poll_timeout to 1 in
> xenpaging_init. The second case is fixed by setting use_poll_timeout in
> case the target is zero and there are no more pages left to resume.
> 
> Signed-off-by: Olaf Hering <olaf@aepfle.de>
> 
> diff -r 03ef29089830 -r b088e473c7fb tools/xenpaging/xenpaging.c
> --- a/tools/xenpaging/xenpaging.c
> +++ b/tools/xenpaging/xenpaging.c
> @@ -482,6 +482,9 @@ static struct xenpaging *xenpaging_init(
>          goto err;
>      }
>  
> +    /* Use a poll timeout until xenpaging got a target from xenstore */
> +    paging->use_poll_timeout = 1;

Don't you want a negative (== infinite) timeout in this case?

> +
>      return paging;
>  
>   err:
> @@ -1019,6 +1022,8 @@ int main(int argc, char *argv[])
>          {
>              if ( paging->num_paged_out )
>                  resume_pages(paging, paging->num_paged_out);
> +            else
> +                paging->use_poll_timeout = 1;
>          }
>          /* Evict more pages if target not reached */
>          else if ( tot_pages > paging->target_tot_pages )
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xenpaging: use poll timeout if no paging target exists
  2012-09-07 16:05 ` Ian Campbell
@ 2012-09-07 16:14   ` Olaf Hering
  2012-09-08  5:44     ` Ian Campbell
  0 siblings, 1 reply; 4+ messages in thread
From: Olaf Hering @ 2012-09-07 16:14 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel@lists.xen.org

On Fri, Sep 07, Ian Campbell wrote:

> > +    /* Use a poll timeout until xenpaging got a target from xenstore */
> > +    paging->use_poll_timeout = 1;
> 
> Don't you want a negative (== infinite) timeout in this case?

Maybe, but this change is the simplest fix for the isse.
Waiting forever may have bad side effects, this is something to consider
for 4.3.

Olaf

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xenpaging: use poll timeout if no paging target exists
  2012-09-07 16:14   ` Olaf Hering
@ 2012-09-08  5:44     ` Ian Campbell
  0 siblings, 0 replies; 4+ messages in thread
From: Ian Campbell @ 2012-09-08  5:44 UTC (permalink / raw)
  To: Olaf Hering; +Cc: xen-devel@lists.xen.org

On Fri, 2012-09-07 at 17:14 +0100, Olaf Hering wrote:
> On Fri, Sep 07, Ian Campbell wrote:
> 
> > > +    /* Use a poll timeout until xenpaging got a target from xenstore */
> > > +    paging->use_poll_timeout = 1;
> > 
> > Don't you want a negative (== infinite) timeout in this case?
> 
> Maybe, but this change is the simplest fix for the isse.
> Waiting forever may have bad side effects, this is something to consider
> for 4.3.

We are in the 4.3 development window now, and this patch didn't say
anything about being for 4.2.

I think this fix (or the larger one) are 4.2.1 material at this point.

Ian

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-09-08  5:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-28  8:32 [PATCH] xenpaging: use poll timeout if no paging target exists Olaf Hering
2012-09-07 16:05 ` Ian Campbell
2012-09-07 16:14   ` Olaf Hering
2012-09-08  5:44     ` Ian Campbell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).