Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp3677300rwl; Sat, 7 Jan 2023 04:07:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXssrHPiK89BAkASyEhzGz5C+hoPle+V/T4JHFLaKIXzV+VL4hQXLgpIzeY/KI1tK8p14PpP X-Received: by 2002:a17:90b:19cc:b0:226:cdcf:da83 with SMTP id nm12-20020a17090b19cc00b00226cdcfda83mr8674605pjb.46.1673093236663; Sat, 07 Jan 2023 04:07:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673093236; cv=none; d=google.com; s=arc-20160816; b=ATHshyhIbdePDX5nb4gzfhqW6d2/+R3TDdCi2WI+21x047rLTy4U0VHSjWWPH4aW4W YtBorVPka8iRskCmxhDXE2TyFa2alkxYu/o9YN8Va2OS6PeLnCT0t7G1rAAtUXXFNsqq WCmii386GahW9/LKYUDfixCTh/zb3RsREfN9vl9u/Kblle7cvIhQ2wPbbF2vdIn/aQfL dnUM7pNGzwe4ZoZF3wEbzDBAagUlD5VsMs4v2WEJydFjw8/J/SzC7MHLv5LbofJUPk16 7OyxvCnfosvQHH+melMpqQzuQEFW1hPt6wBtAv8QkGOWmhlPk17rFBtRhC9Ico6ah4rs gZuQ== 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=FLGeeiX99ZdKBwzoi7gJevgvo93/CE40yLBgMH+PF2c=; b=b2gmv7CZTjkX7+dI4kPwQKk72g51Pt/PlSgax3wtBSp0i4uVZVGukEA641y2yzj5/C aIr31hFaFNPLamfkTTIadToEHxJ5BPQng5bTVMToWFS9YtkJRd4ZFPc6PRR/1HXpbZSN 6v98jM+1jb/Gh5pZjctasIkktPb1tepgnyn1q8rm1DxVqAxcd/VItsrIBq3vmr4kh5ay xXltslYp+XuaOZQKZuoa2iDojiRZtgHq1sWNQy2q4t9zcNvxSRkSM2eK/JR/HYoaNrQD SCynUxwq/4SQllwk/QXwaSUGdiwaYwGnzirusWy8DUQko5P66Ae8SBSDVGRTFOr5OT+d qCuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=TFbvazGD; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e21-20020a637455000000b004795c10a6c6si4017681pgn.665.2023.01.07.04.07.09; Sat, 07 Jan 2023 04:07:16 -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=TFbvazGD; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 S231611AbjAGLgp (ORCPT + 55 others); Sat, 7 Jan 2023 06:36:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229475AbjAGLgn (ORCPT ); Sat, 7 Jan 2023 06:36:43 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26AA676208; Sat, 7 Jan 2023 03:36:42 -0800 (PST) Date: Sat, 07 Jan 2023 11:36:40 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1673091400; 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=FLGeeiX99ZdKBwzoi7gJevgvo93/CE40yLBgMH+PF2c=; b=TFbvazGDKE4OXZk4ezJn8eOpIFxvyiMIR9SNAFuIKMwj2S8Ek9aTjdX6DlJe+m2kKE4HoV 0MR6fdUznK/8F9gAVU3uhmJBe4Qt/CNjWoGEE/ECJC1FFOMcPEE3s+TR3wXmKqURrdVFjt Ux5UQNAY1FrAaog7nVmCPjg1S831PGk8uA5hqS/TeWhesUpYBgitYmdghHupXXP5VvWfgy /7bl6TI3odQ2BifCp5y+Xkd26/EsFXmbYpa/cOlVziwggmeTKoUolLmE5yw2Q5u2r3XFPr PRuXkJis3t5AE7+j9j7aR1yv5PZFnIaMJZ5aECm/LKRWYDggPyDU8nYqiM3JQA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1673091400; 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=FLGeeiX99ZdKBwzoi7gJevgvo93/CE40yLBgMH+PF2c=; b=42u01Ivvai5h7drSrJ2ymLXDlM8/gfUkK5DPWhlQgFLoV917VUMixeDMnKG7J9753ny1x2 PECq/5RcbT+ZxPBA== From: "tip-bot2 for Yair Podemsky" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/urgent] sched/core: Fix arch_scale_freq_tick() on tickless systems Cc: "Peter Zijlstra (Intel)" , Yair Podemsky , Ingo Molnar , Valentin Schneider , Giovanni Gherdovich , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221130125121.34407-1-ypodemsk@redhat.com> References: <20221130125121.34407-1-ypodemsk@redhat.com> MIME-Version: 1.0 Message-ID: <167309140038.4906.5738152542834674773.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: 7bit 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 The following commit has been merged into the sched/urgent branch of tip: Commit-ID: 7fb3ff22ad8772bbf0e3ce1ef3eb7b09f431807f Gitweb: https://git.kernel.org/tip/7fb3ff22ad8772bbf0e3ce1ef3eb7b09f431807f Author: Yair Podemsky AuthorDate: Wed, 30 Nov 2022 14:51:21 +02:00 Committer: Ingo Molnar CommitterDate: Sat, 07 Jan 2023 12:25:50 +01:00 sched/core: Fix arch_scale_freq_tick() on tickless systems In order for the scheduler to be frequency invariant we measure the ratio between the maximum CPU frequency and the actual CPU frequency. During long tickless periods of time the calculations that keep track of that might overflow, in the function scale_freq_tick(): if (check_shl_overflow(acnt, 2*SCHED_CAPACITY_SHIFT, &acnt)) goto error; eventually forcing the kernel to disable the feature for all CPUs, and show the warning message: "Scheduler frequency invariance went wobbly, disabling!". Let's avoid that by limiting the frequency invariant calculations to CPUs with regular tick. Fixes: e2b0d619b400 ("x86, sched: check for counters overflow in frequency invariant accounting") Suggested-by: "Peter Zijlstra (Intel)" Signed-off-by: Yair Podemsky Signed-off-by: Ingo Molnar Reviewed-by: Valentin Schneider Acked-by: Giovanni Gherdovich Link: https://lore.kernel.org/r/20221130125121.34407-1-ypodemsk@redhat.com --- kernel/sched/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 25b582b..965d813 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5504,7 +5504,9 @@ void scheduler_tick(void) unsigned long thermal_pressure; u64 resched_latency; - arch_scale_freq_tick(); + if (housekeeping_cpu(cpu, HK_TYPE_TICK)) + arch_scale_freq_tick(); + sched_clock_tick(); rq_lock(rq, &rf);