From nobody Mon Sep 15 07:51:39 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EED4C54EBD for ; Fri, 13 Jan 2023 12:15:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229989AbjAMMPL (ORCPT ); Fri, 13 Jan 2023 07:15:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233174AbjAMMOD (ORCPT ); Fri, 13 Jan 2023 07:14:03 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6E6339F81; Fri, 13 Jan 2023 04:08:51 -0800 (PST) Date: Fri, 13 Jan 2023 12:08:48 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1673611729; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x6dIdypkBK6HsJOD3L5BxXznkD+4zbfENE3DiayHHIw=; b=GtfOgoQ4kgbE+dDKrHim1oLLxxqBtlMZAXWYBQa5paw0b30FehpPAGWgq9hMwAQvH3fou5 UVfm0+K5Xstvyt62LKhoPJ9ZisCJ31LCqjy0xdcZfqsw+8jw/2fWVFb48kZBpoDTmnEcYd eZrnOTF1MWDLd+/gbOqQ2OQhAZ189HiOLfTOfiBx728QnFFH4yZKvVd4oo0iVRf26XUSoc vzeXlGtgvGI+6OKhCPWHlcm2+8W+tlgcJh+7RXinQpxEhqFF75GcuOEbt5bponnwHKbQUP EIfULfLIBa+ZKYFq94wwxIGPXXdZuo+tHwzU+gEkel56ZKmfrJjVPs/aCau6kw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1673611729; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x6dIdypkBK6HsJOD3L5BxXznkD+4zbfENE3DiayHHIw=; b=ItVqVi3Qh535OK/QzZ/CpIGVdOKfboBacba1XPVdtfHbATKnA5/7WmwPx6/2PsfLC4VKFa H0aP9Z+coOUt+aDA== From: "tip-bot2 for Qais Yousef" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/urgent] sched/uclamp: Fix a uninitialized variable warnings Cc: kernel test robot , Dan Carpenter , "Qais Yousef (Google)" , "Peter Zijlstra (Intel)" , Vincent Guittot , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230112122708.330667-2-qyousef@layalina.io> References: <20230112122708.330667-2-qyousef@layalina.io> MIME-Version: 1.0 Message-ID: <167361172877.4906.11238331936337434090.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/urgent branch of tip: Commit-ID: e26fd28db82899be71b4b949527373d0a6be1e65 Gitweb: https://git.kernel.org/tip/e26fd28db82899be71b4b949527373d0a= 6be1e65 Author: Qais Yousef AuthorDate: Thu, 12 Jan 2023 12:27:07=20 Committer: Peter Zijlstra CommitterDate: Fri, 13 Jan 2023 11:40:21 +01:00 sched/uclamp: Fix a uninitialized variable warnings Addresses the following warnings: > config: riscv-randconfig-m031-20221111 > compiler: riscv64-linux-gcc (GCC) 12.1.0 > > smatch warnings: > kernel/sched/fair.c:7263 find_energy_efficient_cpu() error: uninitialized= symbol 'util_min'. > kernel/sched/fair.c:7263 find_energy_efficient_cpu() error: uninitialized= symbol 'util_max'. Fixes: 244226035a1f ("sched/uclamp: Fix fits_capacity() check in feec()") Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Qais Yousef (Google) Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Vincent Guittot Link: https://lore.kernel.org/r/20230112122708.330667-2-qyousef@layalina.io --- kernel/sched/fair.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index c36aa54..be43731 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7229,10 +7229,10 @@ static int find_energy_efficient_cpu(struct task_st= ruct *p, int prev_cpu) eenv_task_busy_time(&eenv, p, prev_cpu); =20 for (; pd; pd =3D pd->next) { + unsigned long util_min =3D p_util_min, util_max =3D p_util_max; unsigned long cpu_cap, cpu_thermal_cap, util; unsigned long cur_delta, max_spare_cap =3D 0; unsigned long rq_util_min, rq_util_max; - unsigned long util_min, util_max; unsigned long prev_spare_cap =3D 0; int max_spare_cap_cpu =3D -1; unsigned long base_energy; @@ -7251,6 +7251,8 @@ static int find_energy_efficient_cpu(struct task_stru= ct *p, int prev_cpu) eenv.pd_cap =3D 0; =20 for_each_cpu(cpu, cpus) { + struct rq *rq =3D cpu_rq(cpu); + eenv.pd_cap +=3D cpu_thermal_cap; =20 if (!cpumask_test_cpu(cpu, sched_domain_span(sd))) @@ -7269,24 +7271,19 @@ static int find_energy_efficient_cpu(struct task_st= ruct *p, int prev_cpu) * much capacity we can get out of the CPU; this is * aligned with sched_cpu_util(). */ - if (uclamp_is_used()) { - if (uclamp_rq_is_idle(cpu_rq(cpu))) { - util_min =3D p_util_min; - util_max =3D p_util_max; - } else { - /* - * Open code uclamp_rq_util_with() except for - * the clamp() part. Ie: apply max aggregation - * only. util_fits_cpu() logic requires to - * operate on non clamped util but must use the - * max-aggregated uclamp_{min, max}. - */ - rq_util_min =3D uclamp_rq_get(cpu_rq(cpu), UCLAMP_MIN); - rq_util_max =3D uclamp_rq_get(cpu_rq(cpu), UCLAMP_MAX); - - util_min =3D max(rq_util_min, p_util_min); - util_max =3D max(rq_util_max, p_util_max); - } + if (uclamp_is_used() && !uclamp_rq_is_idle(rq)) { + /* + * Open code uclamp_rq_util_with() except for + * the clamp() part. Ie: apply max aggregation + * only. util_fits_cpu() logic requires to + * operate on non clamped util but must use the + * max-aggregated uclamp_{min, max}. + */ + rq_util_min =3D uclamp_rq_get(rq, UCLAMP_MIN); + rq_util_max =3D uclamp_rq_get(rq, UCLAMP_MAX); + + util_min =3D max(rq_util_min, p_util_min); + util_max =3D max(rq_util_max, p_util_max); } if (!util_fits_cpu(util, util_min, util_max, cpu)) continue;