From patchwork Fri Sep 27 07:00:16 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: 11163895 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CDC2476 for ; Fri, 27 Sep 2019 07:02:45 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B471420872 for ; Fri, 27 Sep 2019 07:02:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B471420872 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iDkFb-0003An-Jv; Fri, 27 Sep 2019 07:01:11 +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 1iDkFa-00039L-2t for xen-devel@lists.xenproject.org; Fri, 27 Sep 2019 07:01:10 +0000 X-Inumbo-ID: 8ff6690e-e0f4-11e9-966c-12813bfff9fa Received: from mx1.suse.de (unknown [195.135.220.15]) by localhost (Halon) with ESMTPS id 8ff6690e-e0f4-11e9-966c-12813bfff9fa; Fri, 27 Sep 2019 07:01:00 +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 09C2CB14F; Fri, 27 Sep 2019 07:00:59 +0000 (UTC) From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Fri, 27 Sep 2019 09:00:16 +0200 Message-Id: <20190927070050.12405-13-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190927070050.12405-1-jgross@suse.com> References: <20190927070050.12405-1-jgross@suse.com> Subject: [Xen-devel] [PATCH v4 12/46] xen/sched: switch struct task_slice from vcpu to 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 , 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" Let the schedulers put a sched_unit pointer into struct task_slice instead of a vcpu pointer. Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- 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 | 4 ++-- xen/include/xen/sched-if.h | 6 +++--- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/xen/common/sched_arinc653.c b/xen/common/sched_arinc653.c index 5cf47f5622..9ff1d7f245 100644 --- a/xen/common/sched_arinc653.c +++ b/xen/common/sched_arinc653.c @@ -560,9 +560,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_unit structure. + * Otherwise, set new_task equal to the address of the idle task's + * sched_unit structure. */ new_task = (sched_index < sched_priv->num_schedule_entries) ? sched_priv->schedule[sched_index].vc @@ -598,7 +598,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_unit; ret.migrated = 0; BUG_ON(ret.time <= 0); diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c index 350f9636fa..732fd461b5 100644 --- a/xen/common/sched_credit.c +++ b/xen/common/sched_credit.c @@ -1993,9 +1993,9 @@ out: */ ret.time = (is_idle_vcpu(snext->vcpu) ? -1 : tslice); - ret.task = snext->vcpu; + ret.task = snext->vcpu->sched_unit; - CSCHED_VCPU_CHECK(ret.task); + CSCHED_VCPU_CHECK(ret.task->vcpu_list); return ret; } diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c index 7b0872eba5..8857c98dd8 100644 --- a/xen/common/sched_credit2.c +++ b/xen/common/sched_credit2.c @@ -3637,9 +3637,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_unit; - CSCHED2_VCPU_CHECK(ret.task); + CSCHED2_VCPU_CHECK(ret.task->vcpu_list); return ret; } diff --git a/xen/common/sched_null.c b/xen/common/sched_null.c index 06acaf9f90..3e6f9f72e2 100644 --- a/xen/common/sched_null.c +++ b/xen/common/sched_null.c @@ -819,10 +819,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_unit; } else - ret.task = per_cpu(npc, cpu).vcpu; + ret.task = per_cpu(npc, cpu).vcpu->sched_unit; ret.migrated = 0; ret.time = -1; @@ -857,7 +857,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_unit; goto unlock; } } @@ -869,10 +869,10 @@ static struct task_slice null_schedule(const struct scheduler *ops, cpumask_set_cpu(cpu, &prv->cpus_free); } - if ( unlikely(ret.task == NULL || !vcpu_runnable(ret.task)) ) - ret.task = idle_vcpu[cpu]; + if ( unlikely(ret.task == NULL || !unit_runnable(ret.task)) ) + ret.task = idle_vcpu[cpu]->sched_unit; - NULL_VCPU_CHECK(ret.task); + NULL_VCPU_CHECK(ret.task->vcpu_list); return ret; } diff --git a/xen/common/sched_rt.c b/xen/common/sched_rt.c index 3fbe8dad8d..856eae1faa 100644 --- a/xen/common/sched_rt.c +++ b/xen/common/sched_rt.c @@ -1129,7 +1129,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_unit; return ret; } diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 6d27c2f4a5..157b91c439 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -115,7 +115,7 @@ static struct task_slice sched_idle_schedule( const unsigned int cpu = smp_processor_id(); struct task_slice ret = { .time = -1 }; - ret.task = idle_vcpu[cpu]; + ret.task = sched_idle_unit(cpu); return ret; } @@ -1627,7 +1627,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_list; sd->curr = next->sched_unit; diff --git a/xen/include/xen/sched-if.h b/xen/include/xen/sched-if.h index 0587a8d3d2..2b9d50b9fe 100644 --- a/xen/include/xen/sched-if.h +++ b/xen/include/xen/sched-if.h @@ -226,9 +226,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_unit *task; + s_time_t time; + bool_t migrated; }; struct scheduler {