From patchwork Fri Aug 9 14:58:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 11086633 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B0A12746 for ; Fri, 9 Aug 2019 15:00:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9BC8F1FFCA for ; Fri, 9 Aug 2019 15:00:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8FE9D1FFBE; Fri, 9 Aug 2019 15:00:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3EF421FFCA for ; Fri, 9 Aug 2019 15:00:09 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hw6M5-0006hB-6u; Fri, 09 Aug 2019 14:58:57 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hw6Lz-0006XD-Sv for xen-devel@lists.xenproject.org; Fri, 09 Aug 2019 14:58:51 +0000 X-Inumbo-ID: 30beabfe-bab6-11e9-bdfd-ebfd36c8b797 Received: from mx1.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 30beabfe-bab6-11e9-bdfd-ebfd36c8b797; Fri, 09 Aug 2019 14:58:48 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 92DD7B0CC; Fri, 9 Aug 2019 14:58:46 +0000 (UTC) From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Fri, 9 Aug 2019 16:58:10 +0200 Message-Id: <20190809145833.1020-26-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190809145833.1020-1-jgross@suse.com> References: <20190809145833.1020-1-jgross@suse.com> Subject: [Xen-devel] [PATCH v2 25/48] xen/sched: add runstate counters to struct sched_unit X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Tim Deegan , Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Dario Faggioli , Julien Grall , Jan Beulich MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add counters to struct sched_unit summing up runstates of associated vcpus. Signed-off-by: Juergen Gross --- RFC V2: add counters for each possible runstate --- xen/common/schedule.c | 5 +++++ xen/include/xen/sched.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 7b0ff8395e..3f8fffc329 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -236,6 +236,7 @@ static inline void vcpu_runstate_change( struct vcpu *v, int new_state, s_time_t new_entry_time) { s_time_t delta; + struct sched_unit *unit = v->sched_unit; ASSERT(v->runstate.state != new_state); ASSERT(spin_is_locked(get_sched_res(v->processor)->schedule_lock)); @@ -244,6 +245,9 @@ static inline void vcpu_runstate_change( trace_runstate_change(v, new_state); + unit->runstate_cnt[v->runstate.state]--; + unit->runstate_cnt[new_state]++; + delta = new_entry_time - v->runstate.state_entry_time; if ( delta > 0 ) { @@ -366,6 +370,7 @@ static struct sched_unit *sched_alloc_unit(struct vcpu *v) unit->vcpu_list = v; unit->unit_id = v->vcpu_id; unit->domain = d; + unit->runstate_cnt[v->runstate.state]++; for ( prev_unit = &d->sched_unit_list; *prev_unit; prev_unit = &(*prev_unit)->next_in_list ) diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index f639b164b5..0cece3b921 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -274,6 +274,8 @@ struct sched_unit { /* Last time unit got (de-)scheduled. */ uint64_t state_entry_time; + /* Vcpu state summary. */ + unsigned int runstate_cnt[4]; /* Currently running on a CPU? */ bool is_running;