From nobody Fri Dec 26 15:25:07 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6ADDA199A9 for ; Wed, 3 Jan 2024 12:56:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BC06214BF; Wed, 3 Jan 2024 04:57:43 -0800 (PST) Received: from e126645.nice.arm.com (e126645.nice.arm.com [10.34.100.129]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 1B88B3F64C; Wed, 3 Jan 2024 04:56:55 -0800 (PST) From: Pierre Gondois To: linux-kernel@vger.kernel.org Cc: Pierre Gondois , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider Subject: [PATCH 1/2] sched/topology: Annotate RCU pointers properly Date: Wed, 3 Jan 2024 13:56:47 +0100 Message-Id: <20240103125648.194516-2-pierre.gondois@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240103125648.194516-1-pierre.gondois@arm.com> References: <20240103125648.194516-1-pierre.gondois@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Cleanup RCU-related spare errors by annotating RCU pointers. sched_domains_numa_distance: error: incompatible types in comparison expression (different address spaces): int [noderef] __rcu * int * sched_domains_numa_masks: error: incompatible types in comparison expression (different address spaces): struct cpumask **[noderef] __rcu * struct cpumask *** Signed-off-by: Pierre Gondois --- kernel/sched/topology.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index 10d1391e7416..0342a4f41f09 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -1542,8 +1542,8 @@ static int sched_domains_numa_levels; static int sched_domains_curr_level; =20 int sched_max_numa_distance; -static int *sched_domains_numa_distance; -static struct cpumask ***sched_domains_numa_masks; +static int __rcu *sched_domains_numa_distance; +static struct cpumask ** __rcu *sched_domains_numa_masks; #endif =20 /* --=20 2.25.1 From nobody Fri Dec 26 15:25:07 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DE76B19BCC for ; Wed, 3 Jan 2024 12:57:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0D95B152B; Wed, 3 Jan 2024 04:57:46 -0800 (PST) Received: from e126645.nice.arm.com (e126645.nice.arm.com [10.34.100.129]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6AF2E3F64C; Wed, 3 Jan 2024 04:56:58 -0800 (PST) From: Pierre Gondois To: linux-kernel@vger.kernel.org Cc: Pierre Gondois , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider Subject: [PATCH 2/2] sched/fair: Use rq in idle_cpu_without() Date: Wed, 3 Jan 2024 13:56:48 +0100 Message-Id: <20240103125648.194516-3-pierre.gondois@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240103125648.194516-1-pierre.gondois@arm.com> References: <20240103125648.194516-1-pierre.gondois@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" idle_cpu_without() could receive a 'struct rq' instead of a cpu number to avoid converting the cpu number to a 'struct rq' two times. Indeed update_sg_wakeup_stats() already makes the conversion. Signed-off-by: Pierre Gondois Reviewed-by: Shrikanth Hegde --- kernel/sched/fair.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 93e928e76959..d38fec26fd3d 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -10184,15 +10184,13 @@ static unsigned int task_running_on_cpu(int cpu, = struct task_struct *p) =20 /** * idle_cpu_without - would a given CPU be idle without p ? - * @cpu: the processor on which idleness is tested. + * @rq: the rq on which idleness is tested. * @p: task which should be ignored. * * Return: 1 if the CPU would be idle. 0 otherwise. */ -static int idle_cpu_without(int cpu, struct task_struct *p) +static int idle_cpu_without(struct rq *rq, struct task_struct *p) { - struct rq *rq =3D cpu_rq(cpu); - if (rq->curr !=3D rq->idle && rq->curr !=3D p) return 0; =20 @@ -10247,7 +10245,7 @@ static inline void update_sg_wakeup_stats(struct sc= hed_domain *sd, /* * No need to call idle_cpu_without() if nr_running is not 0 */ - if (!nr_running && idle_cpu_without(i, p)) + if (!nr_running && idle_cpu_without(rq, p)) sgs->idle_cpus++; =20 /* Check if task fits in the CPU */ --=20 2.25.1