From patchwork Fri Mar 29 15:09:07 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: 10877249 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 016171575 for ; Fri, 29 Mar 2019 15:11:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0D252982D for ; Fri, 29 Mar 2019 15:11:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD1912987C; Fri, 29 Mar 2019 15:11:27 +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 545CB2982D for ; Fri, 29 Mar 2019 15:11:27 +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 1h9t8q-0003z2-VS; Fri, 29 Mar 2019 15:10:00 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1h9t8h-0003fR-8R for xen-devel@lists.xenproject.org; Fri, 29 Mar 2019 15:09:51 +0000 X-Inumbo-ID: b06ed2d8-5234-11e9-bc90-bc764e045a96 Received: from mx1.suse.de (unknown [195.135.220.15]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id b06ed2d8-5234-11e9-bc90-bc764e045a96; Fri, 29 Mar 2019 15:09:47 +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 EFC90AF93; Fri, 29 Mar 2019 15:09:45 +0000 (UTC) From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Fri, 29 Mar 2019 16:09:07 +0100 Message-Id: <20190329150934.17694-23-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190329150934.17694-1-jgross@suse.com> References: <20190329150934.17694-1-jgross@suse.com> Subject: [Xen-devel] [PATCH RFC 22/49] xen/sched: switch struct task_slice from vcpu to sched_item 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 , Robert VanVossen , Dario Faggioli , Julien Grall , Josh Whitehead , Meng Xu , Jan Beulich MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Let the schedulers put a sched_item pointer into struct task_slice instead of a vcpu pointer. Signed-off-by: Juergen Gross --- xen/common/sched_arinc653.c | 8 ++++---- xen/common/sched_credit.c | 4 ++-- xen/common/sched_credit2.c | 4 ++-- xen/common/sched_null.c | 12 ++++++------ xen/common/sched_rt.c | 2 +- xen/common/schedule.c | 2 +- xen/include/xen/sched-if.h | 6 +++--- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/xen/common/sched_arinc653.c b/xen/common/sched_arinc653.c index 9dc1ff6a73..5733a2a6b8 100644 --- a/xen/common/sched_arinc653.c +++ b/xen/common/sched_arinc653.c @@ -554,9 +554,9 @@ a653sched_do_schedule( /* * If there are more domains to run in the current major frame, set - * new_task equal to the address of next domain's VCPU structure. - * Otherwise, set new_task equal to the address of the idle task's VCPU - * structure. + * new_task equal to the address of next domain's sched_item structure. + * Otherwise, set new_task equal to the address of the idle task's + * sched_item structure. */ new_task = (sched_index < sched_priv->num_schedule_entries) ? sched_priv->schedule[sched_index].vc @@ -592,7 +592,7 @@ a653sched_do_schedule( * of the selected task's VCPU structure. */ ret.time = next_switch_time - now; - ret.task = new_task; + ret.task = new_task->sched_item; ret.migrated = 0; BUG_ON(ret.time <= 0); diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c index 3ea0d40afb..29076e362b 100644 --- a/xen/common/sched_credit.c +++ b/xen/common/sched_credit.c @@ -2005,9 +2005,9 @@ out: */ ret.time = (is_idle_vcpu(snext->vcpu) ? -1 : tslice); - ret.task = snext->vcpu; + ret.task = snext->vcpu->sched_item; - CSCHED_VCPU_CHECK(ret.task); + CSCHED_VCPU_CHECK(ret.task->vcpu); return ret; } diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c index 8bee7cb9a2..9bf045d20f 100644 --- a/xen/common/sched_credit2.c +++ b/xen/common/sched_credit2.c @@ -3636,9 +3636,9 @@ csched2_schedule( * Return task to run next... */ ret.time = csched2_runtime(ops, cpu, snext, now); - ret.task = snext->vcpu; + ret.task = snext->vcpu->sched_item; - CSCHED2_VCPU_CHECK(ret.task); + CSCHED2_VCPU_CHECK(ret.task->vcpu); return ret; } diff --git a/xen/common/sched_null.c b/xen/common/sched_null.c index 5570cc1a8c..62c51e2c83 100644 --- a/xen/common/sched_null.c +++ b/xen/common/sched_null.c @@ -746,10 +746,10 @@ static struct task_slice null_schedule(const struct scheduler *ops, if ( tasklet_work_scheduled ) { trace_var(TRC_SNULL_TASKLET, 1, 0, NULL); - ret.task = idle_vcpu[cpu]; + ret.task = idle_vcpu[cpu]->sched_item; } else - ret.task = per_cpu(npc, cpu).vcpu; + ret.task = per_cpu(npc, cpu).vcpu->sched_item; ret.migrated = 0; ret.time = -1; @@ -784,7 +784,7 @@ static struct task_slice null_schedule(const struct scheduler *ops, { vcpu_assign(prv, wvc->vcpu, cpu); list_del_init(&wvc->waitq_elem); - ret.task = wvc->vcpu; + ret.task = wvc->vcpu->sched_item; goto unlock; } } @@ -793,10 +793,10 @@ static struct task_slice null_schedule(const struct scheduler *ops, spin_unlock(&prv->waitq_lock); } - if ( unlikely(ret.task == NULL || !vcpu_runnable(ret.task)) ) - ret.task = idle_vcpu[cpu]; + if ( unlikely(ret.task == NULL || !item_runnable(ret.task)) ) + ret.task = idle_vcpu[cpu]->sched_item; - NULL_VCPU_CHECK(ret.task); + NULL_VCPU_CHECK(ret.task->vcpu); return ret; } diff --git a/xen/common/sched_rt.c b/xen/common/sched_rt.c index 0639cdce0a..374a9d2383 100644 --- a/xen/common/sched_rt.c +++ b/xen/common/sched_rt.c @@ -1138,7 +1138,7 @@ rt_schedule(const struct scheduler *ops, s_time_t now, bool_t tasklet_work_sched } ret.time = snext->cur_budget; /* invoke the scheduler next time */ } - ret.task = snext->vcpu; + ret.task = snext->vcpu->sched_item; return ret; } diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 7a7ec56402..b295b0b81e 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -1549,7 +1549,7 @@ static void schedule(void) sched = this_cpu(scheduler); next_slice = sched->do_schedule(sched, now, tasklet_work_scheduled); - next = next_slice.task; + next = next_slice.task->vcpu; sd->curr = next->sched_item; diff --git a/xen/include/xen/sched-if.h b/xen/include/xen/sched-if.h index 1e4a7e1e64..3dcf1dca19 100644 --- a/xen/include/xen/sched-if.h +++ b/xen/include/xen/sched-if.h @@ -208,9 +208,9 @@ static inline spinlock_t *pcpu_schedule_trylock(unsigned int cpu) } struct task_slice { - struct vcpu *task; - s_time_t time; - bool_t migrated; + struct sched_item *task; + s_time_t time; + bool_t migrated; }; struct scheduler {