* [PATCH] Removal of redundant check
@ 2016-12-14 18:19 Praveen Kumar
2016-12-15 0:18 ` Dario Faggioli
0 siblings, 1 reply; 3+ messages in thread
From: Praveen Kumar @ 2016-12-14 18:19 UTC (permalink / raw)
To: xen-devel; +Cc: george.dunlap, Dario Faggioli
[-- 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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] Removal of redundant check
2016-12-14 18:19 [PATCH] Removal of redundant check Praveen Kumar
@ 2016-12-15 0:18 ` Dario Faggioli
2016-12-15 5:34 ` George Dunlap
0 siblings, 1 reply; 3+ messages in thread
From: Dario Faggioli @ 2016-12-15 0:18 UTC (permalink / raw)
To: Praveen Kumar, xen-devel; +Cc: george.dunlap
[-- Attachment #1.1: Type: text/plain, Size: 1835 bytes --]
Hello!
Glad to see he patch here. One thing, about the subject line: it should
contains "tags", i.e., an indication of the component that the patch
affects.
So, for example, in this case, the patch touches Credit1, which means
scheduling inside Xen. So, a valid subject line could be:
[PATCH] xen: sched: removal of redundant check in Credit
or:
[PATCH] xen: credit: removal of redundant check
On Wed, 2016-12-14 at 23:49 +0530, Praveen Kumar wrote:
> The patch gets rid of a redundant check in csched_vcpu_acct which
> adds
> more code clarity and performance.
>
I'd remove "which adds more code clarity and performance" and put here
something like:
"In fact, the function is only called from csched_tick, which already
checks that current is not the idle vcpu."
> 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>
>
Apart from what just said above, the patch looks good to me. Can you
send version 2 with the changelog updated?
Oh, and I see that you are both inlining in the email and attaching the
patch. I personally don't particularly mind, but that may make the life
of a committer (the person which, when the patch will have all the
Acks, will put it inside the Xen git repository) a bit more difficult.
So, this is mostly George's call, I think, but FWIW, I'd suggest you
avoid doing that. :-)
Thanks and Regards,
Dario
--
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 127 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Removal of redundant check
2016-12-15 0:18 ` Dario Faggioli
@ 2016-12-15 5:34 ` George Dunlap
0 siblings, 0 replies; 3+ messages in thread
From: George Dunlap @ 2016-12-15 5:34 UTC (permalink / raw)
To: Dario Faggioli; +Cc: Praveen Kumar, George Dunlap, Xen-devel List
> On Dec 15, 2016, at 8:18 AM, Dario Faggioli <dario.faggioli@citrix.com> wrote:
> Oh, and I see that you are both inlining in the email and attaching the
> patch. I personally don't particularly mind, but that may make the life
> of a committer (the person which, when the patch will have all the
> Acks, will put it inside the Xen git repository) a bit more difficult.
>
> So, this is mostly George's call, I think, but FWIW, I'd suggest you
> avoid doing that. :-)
git send-email is usually easier for everyone (both submitter and committer); but some people’s corporate setup doesn’t allow its use. Jan’s patches are always pasted in-line and attached, for instance.
-George
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-12-15 5:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-14 18:19 [PATCH] Removal of redundant check Praveen Kumar
2016-12-15 0:18 ` Dario Faggioli
2016-12-15 5:34 ` George Dunlap
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).