From: Dario Faggioli Subject: [PATCH 2/4] xen: sched: make counters for vCPU sleep and wakeup generic Date: Thu, 26 Feb 2015 14:37:02 +0100 Message-ID: <20150226133702.15590.91787.stgit@Solace.station> References: <20150226131406.15590.21081.stgit@Solace.station> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20150226131406.15590.21081.stgit@Solace.station> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Xen-devel Cc: George Dunlap , Keir Fraser , Jan Beulich List-Id: xen-devel@lists.xenproject.org and update them from Credit2 and RTDS. In Credit2, while there, remove some stale comments too. Signed-off-by: Dario Faggioli Cc: George Dunlap Cc: Jan Beulich Cc: Keir Fraser --- xen/common/sched_credit2.c | 12 ++++++++---- xen/common/sched_rt.c | 12 ++++++++++++ xen/include/xen/perfc_defn.h | 10 +++++----- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c index ad0a5d4..2b852cc 100644 --- a/xen/common/sched_credit2.c +++ b/xen/common/sched_credit2.c @@ -931,6 +931,7 @@ csched2_vcpu_sleep(const struct scheduler *ops, struct vcpu *vc) struct csched2_vcpu * const svc = CSCHED2_VCPU(vc); BUG_ON( is_idle_vcpu(vc) ); + SCHED_STAT_CRANK(vcpu_sleep); if ( per_cpu(schedule_data, vc->processor).curr == vc ) cpu_raise_softirq(vc->processor, SCHEDULE_SOFTIRQ); @@ -956,19 +957,22 @@ csched2_vcpu_wake(const struct scheduler *ops, struct vcpu *vc) BUG_ON( is_idle_vcpu(vc) ); - /* Make sure svc priority mod happens before runq check */ if ( unlikely(per_cpu(schedule_data, vc->processor).curr == vc) ) { + SCHED_STAT_CRANK(vcpu_wake_running); goto out; } - if ( unlikely(__vcpu_on_runq(svc)) ) { - /* If we've boosted someone that's already on a runqueue, prioritize - * it and inform the cpu in question. */ + SCHED_STAT_CRANK(vcpu_wake_onrunq); goto out; } + if ( likely(vcpu_runnable(vc)) ) + SCHED_STAT_CRANK(vcpu_wake_runnable); + else + SCHED_STAT_CRANK(vcpu_wake_not_runnable); + /* If the context hasn't been saved for this vcpu yet, we can't put it on * another runqueue. Instead, we set a flag so that it will be put on the runqueue * after the context has been saved. */ diff --git a/xen/common/sched_rt.c b/xen/common/sched_rt.c index 58dd646..49d1b83 100644 --- a/xen/common/sched_rt.c +++ b/xen/common/sched_rt.c @@ -851,6 +851,7 @@ rt_vcpu_sleep(const struct scheduler *ops, struct vcpu *vc) struct rt_vcpu * const svc = rt_vcpu(vc); BUG_ON( is_idle_vcpu(vc) ); + SCHED_STAT_CRANK(vcpu_sleep); if ( curr_on_cpu(vc->processor) == vc ) cpu_raise_softirq(vc->processor, SCHEDULE_SOFTIRQ); @@ -966,11 +967,22 @@ rt_vcpu_wake(const struct scheduler *ops, struct vcpu *vc) BUG_ON( is_idle_vcpu(vc) ); if ( unlikely(curr_on_cpu(vc->processor) == vc) ) + { + SCHED_STAT_CRANK(vcpu_wake_running); return; + } /* on RunQ/DepletedQ, just update info is ok */ if ( unlikely(__vcpu_on_q(svc)) ) + { + SCHED_STAT_CRANK(vcpu_wake_onrunq); return; + } + + if ( likely(vcpu_runnable(vc)) ) + SCHED_STAT_CRANK(vcpu_wake_runnable); + else + SCHED_STAT_CRANK(vcpu_wake_not_runnable); /* If context hasn't been saved for this vcpu yet, we can't put it on * the Runqueue/DepletedQ. Instead, we set a flag so that it will be diff --git a/xen/include/xen/perfc_defn.h b/xen/include/xen/perfc_defn.h index 3ac7b45..2dc78fe 100644 --- a/xen/include/xen/perfc_defn.h +++ b/xen/include/xen/perfc_defn.h @@ -21,6 +21,11 @@ PERFCOUNTER(dom_init, "sched: dom_init") PERFCOUNTER(dom_destroy, "sched: dom_destroy") PERFCOUNTER(vcpu_init, "sched: vcpu_init") PERFCOUNTER(vcpu_destroy, "sched: vcpu_destroy") +PERFCOUNTER(vcpu_sleep, "sched: vcpu_sleep") +PERFCOUNTER(vcpu_wake_running, "sched: vcpu_wake_running") +PERFCOUNTER(vcpu_wake_onrunq, "sched: vcpu_wake_onrunq") +PERFCOUNTER(vcpu_wake_runnable, "sched: vcpu_wake_runnable") +PERFCOUNTER(vcpu_wake_not_runnable, "sched: vcpu_wake_not_runnable") /* credit specific counters */ PERFCOUNTER(delay_ms, "csched: delay") @@ -32,11 +37,6 @@ PERFCOUNTER(acct_reorder, "csched: acct_reorder") PERFCOUNTER(acct_min_credit, "csched: acct_min_credit") PERFCOUNTER(acct_vcpu_active, "csched: acct_vcpu_active") PERFCOUNTER(acct_vcpu_idle, "csched: acct_vcpu_idle") -PERFCOUNTER(vcpu_sleep, "csched: vcpu_sleep") -PERFCOUNTER(vcpu_wake_running, "csched: vcpu_wake_running") -PERFCOUNTER(vcpu_wake_onrunq, "csched: vcpu_wake_onrunq") -PERFCOUNTER(vcpu_wake_runnable, "csched: vcpu_wake_runnable") -PERFCOUNTER(vcpu_wake_not_runnable, "csched: vcpu_wake_not_runnable") PERFCOUNTER(vcpu_park, "csched: vcpu_park") PERFCOUNTER(vcpu_unpark, "csched: vcpu_unpark") PERFCOUNTER(tickle_idlers_none, "csched: tickle_idlers_none")