From patchwork Fri Jan 13 12:08:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 43216 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp234842wrt; Fri, 13 Jan 2023 04:15:42 -0800 (PST) X-Google-Smtp-Source: AMrXdXss9NrC1a7y2FxdmGH/hbU8ie47WSOmDXXIaziB6qa9QIN3WH8PeUhAUOrjbt9rYPe7mKrM X-Received: by 2002:a05:6a20:429f:b0:a4:aa40:2260 with SMTP id o31-20020a056a20429f00b000a4aa402260mr14680613pzj.60.1673612142473; Fri, 13 Jan 2023 04:15:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673612142; cv=none; d=google.com; s=arc-20160816; b=dOGrFJgq06//Q7+O07Vsc/KbppSkenAK/u2l4+Ww8EyEq9MQOccGgYdDU+DSW32Uyx 4zPn3aTLbXvSGRGAbhcHwwTbFEae6s6RvE9FDSOBgB1z9pzrlNQuE7hN/GmY78zT1aoV K4pXvUgaXWTk7OZRliyGgkgyitKJMreiojJf1IZSPA+iW18babtOir+PIX3+qJHuoDjy D4EwpORQYv/tNGdqqg38jOQOjGp2TX5QEcj5VLv0RegV6aKuytFmfHRHAxTiP24lq4Xn FjJvMdwIjfcDQISU4pffdkON9W1lEwgPSxJ5KOqdYn81V9q1kBWk0DrPk+kAB8jb2MLD dVIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=x6dIdypkBK6HsJOD3L5BxXznkD+4zbfENE3DiayHHIw=; b=y8EtXSzx8vL1IFLUZGZlZCdIr5oAVpIO0IQIaW+6vPdztlmB1G5hkwFYdmafsbDVvY 4Q3ZW2Wo/z/e6eNDBL9wAgkVB04Mv6SOQ+gwj8yRrkVQu8xHlg89No0Cb8UFxrFxeqmp 5A0mbfQcsORtitJ5a0Xc+dK2kfG7nHXCQ5vk/Y/KNf35M1eqfBY6pJrDULe8xb34Btu5 goRlFqFZ6DxdKIUy4aEtCOx2ntVxUP6vKeLWyWfsf6BqO1mcOE4esVRtaGU9QkecaT6x 6/U9MYt9vU5d7V4cX8bR6Vv37vR3JrqkoKyV4qJroPPOEE7hF5zTbN+oc0MAM5BV/CWy 70lA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=GtfOgoQ4; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h38-20020a635326000000b004a92e6dba8esi20216697pgb.112.2023.01.13.04.15.27; Fri, 13 Jan 2023 04:15:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=GtfOgoQ4; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241334AbjAMMPJ (ORCPT + 99 others); Fri, 13 Jan 2023 07:15:09 -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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754820242404356763?= X-GMAIL-MSGID: =?utf-8?q?1754909525696379064?= The following commit has been merged into the sched/urgent branch of tip: Commit-ID: e26fd28db82899be71b4b949527373d0a6be1e65 Gitweb: https://git.kernel.org/tip/e26fd28db82899be71b4b949527373d0a6be1e65 Author: Qais Yousef AuthorDate: Thu, 12 Jan 2023 12:27:07 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_struct *p, int prev_cpu) eenv_task_busy_time(&eenv, p, prev_cpu); for (; pd; pd = pd->next) { + unsigned long util_min = p_util_min, util_max = p_util_max; unsigned long cpu_cap, cpu_thermal_cap, util; unsigned long cur_delta, max_spare_cap = 0; unsigned long rq_util_min, rq_util_max; - unsigned long util_min, util_max; unsigned long prev_spare_cap = 0; int max_spare_cap_cpu = -1; unsigned long base_energy; @@ -7251,6 +7251,8 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu) eenv.pd_cap = 0; for_each_cpu(cpu, cpus) { + struct rq *rq = cpu_rq(cpu); + eenv.pd_cap += cpu_thermal_cap; if (!cpumask_test_cpu(cpu, sched_domain_span(sd))) @@ -7269,24 +7271,19 @@ static int find_energy_efficient_cpu(struct task_struct *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 = p_util_min; - util_max = 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 = uclamp_rq_get(cpu_rq(cpu), UCLAMP_MIN); - rq_util_max = uclamp_rq_get(cpu_rq(cpu), UCLAMP_MAX); - - util_min = max(rq_util_min, p_util_min); - util_max = 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 = uclamp_rq_get(rq, UCLAMP_MIN); + rq_util_max = uclamp_rq_get(rq, UCLAMP_MAX); + + util_min = max(rq_util_min, p_util_min); + util_max = max(rq_util_max, p_util_max); } if (!util_fits_cpu(util, util_min, util_max, cpu)) continue;