xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Praveen Kumar <kpraveen.lkml@gmail.com>
To: xen-devel@lists.xen.org
Cc: george.dunlap@eu.citrix.com, Dario Faggioli <dario.faggioli@citrix.com>
Subject: [PATCH] Removal of redundant check
Date: Wed, 14 Dec 2016 23:49:58 +0530	[thread overview]
Message-ID: <1481739598.6878.10.camel@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1147 bytes --]

The patch gets rid of a redundant check in csched_vcpu_acct which adds
more code clarity and performance. This patch also adds an ASSERT to
the same effect, in order to make assumption ( i.e., no calling this on
idle vcpus) even more clear and as a guard for future mis-use.

Signed-off-by: Praveen Kumar <kpraveen.lkml@gmail.com>

diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
index fc3a321..dfe8545 100644
--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
@@ -941,6 +941,7 @@ csched_vcpu_acct(struct csched_private *prv,
unsigned int cpu)

     ASSERT( current->processor == cpu );
     ASSERT( svc->sdom != NULL );
+    ASSERT( !is_idle_vcpu(svc->vcpu) );

     /*
      * If this VCPU's priority was boosted when it last awoke, reset
it.
@@ -957,8 +958,7 @@ csched_vcpu_acct(struct csched_private *prv,
unsigned int cpu)
     /*
      * Update credits
      */
-    if ( !is_idle_vcpu(svc->vcpu) )
-        burn_credits(svc, NOW());
+    burn_credits(svc, NOW());

     /*
      * Put this VCPU and domain back on the active list if it was

[-- Attachment #2: redundantCheckRemoval.patch --]
[-- Type: text/x-patch, Size: 1079 bytes --]

The patch gets rid of a redundant check in csched_vcpu_acct which adds more code
clarity and performance. This patch also adds an ASSERT to the same effect, in
order to make assumption ( i.e., no calling this on idle vcpus) even more clear
and as a guard for future mis-use.

Signed-off-by: Praveen Kumar <kpraveen.lkml@gmail.com>

diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
index fc3a321..dfe8545 100644
--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
@@ -941,6 +941,7 @@ csched_vcpu_acct(struct csched_private *prv, unsigned int cpu)

     ASSERT( current->processor == cpu );
     ASSERT( svc->sdom != NULL );
+    ASSERT( !is_idle_vcpu(svc->vcpu) );

     /*
      * If this VCPU's priority was boosted when it last awoke, reset it.
@@ -957,8 +958,7 @@ csched_vcpu_acct(struct csched_private *prv, unsigned int cpu)
     /*
      * Update credits
      */
-    if ( !is_idle_vcpu(svc->vcpu) )
-        burn_credits(svc, NOW());
+    burn_credits(svc, NOW());

     /*
      * Put this VCPU and domain back on the active list if it was

[-- Attachment #3: Type: text/plain, Size: 127 bytes --]

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

             reply	other threads:[~2016-12-14 18:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-14 18:19 Praveen Kumar [this message]
2016-12-15  0:18 ` [PATCH] Removal of redundant check Dario Faggioli
2016-12-15  5:34   ` George Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1481739598.6878.10.camel@gmail.com \
    --to=kpraveen.lkml@gmail.com \
    --cc=dario.faggioli@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).