From nobody Sat Apr 27 22:07:53 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1579770258; cv=none; d=zohomail.com; s=zohoarc; b=PfP0l+RX+upiR/H+QFHMimK3EMGKAwPHGL78HzAC/zvSehYipHCr+vc5eSG2CV4mI95UqYE2cdEtC3HU+sBOIuGxBL9xWAExjQAx5/7gIKJr/of4fBHt05sCt/WQ1zg/pKWI+XTRWZo29zGHS8lbrVlE0FSxF73zAFHARtu3DEU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579770258; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=E9nleUpq35BmUKz0bJ0yVaQmj8KGoi1F6jxeFX2czeM=; b=kHV5MlJV9hIalEOZa5N2647vMJCTrfWj5hR83m7zoNEchVNBpENRcdoeqPpunNFv5sQVvBrq/+BI+iCCZC8HCnymQRlNM3G6XJG1CIx8q/zWgIilrRrO+zeFih/Py2AaCdIhnEe4enEeXDpF8cMcHN+mOnFn9brsJG+T08QIyMc= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1579770258041868.5104599292036; Thu, 23 Jan 2020 01:04:18 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iuYOn-0003qh-8L; Thu, 23 Jan 2020 09:03:37 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iuYOl-0003qc-PD for xen-devel@lists.xenproject.org; Thu, 23 Jan 2020 09:03:35 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 36fd1af0-3dbf-11ea-8e9a-bc764e2007e4; Thu, 23 Jan 2020 09:03:26 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 80EB6ADEB; Thu, 23 Jan 2020 09:03:25 +0000 (UTC) X-Inumbo-ID: 36fd1af0-3dbf-11ea-8e9a-bc764e2007e4 X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Thu, 23 Jan 2020 10:03:23 +0100 Message-Id: <20200123090323.16272-1-jgross@suse.com> X-Mailer: git-send-email 2.16.4 Subject: [Xen-devel] [PATCH] xen/sched: avoid cpumasks on stack in sched/core.c 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 , George Dunlap , Dario Faggioli MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" There are still several instances of cpumask_t on the stack in scheduling code. Avoid them as far as possible. Signed-off-by: Juergen Gross Reviewed-by: Dario Faggioli --- xen/common/sched/core.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index 944164d78a..73799c2508 100644 --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -1178,7 +1178,6 @@ int cpu_disable_scheduler(unsigned int cpu) { struct domain *d; const struct cpupool *c; - cpumask_t online_affinity; int ret =3D 0; =20 rcu_read_lock(&sched_res_rculock); @@ -1196,8 +1195,7 @@ int cpu_disable_scheduler(unsigned int cpu) unsigned long flags; spinlock_t *lock =3D unit_schedule_lock_irqsave(unit, &flags); =20 - cpumask_and(&online_affinity, unit->cpu_hard_affinity, c->cpu_= valid); - if ( cpumask_empty(&online_affinity) && + if ( !cpumask_intersects(unit->cpu_hard_affinity, c->cpu_valid= ) && cpumask_test_cpu(cpu, unit->cpu_hard_affinity) ) { if ( sched_check_affinity_broken(unit) ) @@ -1336,12 +1334,10 @@ static int vcpu_set_affinity( =20 int vcpu_set_hard_affinity(struct vcpu *v, const cpumask_t *affinity) { - cpumask_t online_affinity; cpumask_t *online; =20 online =3D VCPU2ONLINE(v); - cpumask_and(&online_affinity, affinity, online); - if ( cpumask_empty(&online_affinity) ) + if ( !cpumask_intersects(online, affinity) ) return -EINVAL; =20 return vcpu_set_affinity(v, affinity, v->sched_unit->cpu_hard_affinity= ); @@ -2586,11 +2582,11 @@ static void schedule(void) =20 if ( gran > 1 ) { - cpumask_t mask; + cpumask_t *mask =3D cpumask_scratch_cpu(cpu); =20 prev->rendezvous_in_cnt =3D gran; - cpumask_andnot(&mask, sr->cpus, cpumask_of(cpu)); - cpumask_raise_softirq(&mask, SCHED_SLAVE_SOFTIRQ); + cpumask_andnot(mask, sr->cpus, cpumask_of(cpu)); + cpumask_raise_softirq(mask, SCHED_SLAVE_SOFTIRQ); next =3D sched_wait_rendezvous_in(prev, &lock, cpu, now); if ( !next ) return; --=20 2.16.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel