From patchwork Sat Jan 7 11:36:40 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: 40370 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp1259686wrt; Sat, 7 Jan 2023 03:37:51 -0800 (PST) X-Google-Smtp-Source: AMrXdXs4fC99QCbVfKof8W4vcYzaIzqwrYYdKXka9d3NG6eqM/YlXJ12VjrW03PvU1x7KMogEVIZ X-Received: by 2002:a17:902:9a0b:b0:185:441f:709c with SMTP id v11-20020a1709029a0b00b00185441f709cmr67005422plp.33.1673091471118; Sat, 07 Jan 2023 03:37:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673091471; cv=none; d=google.com; s=arc-20160816; b=AQ0FdPZDH693tnaNJjDUsmpYL0bZG3KEUSJphNZkzjamDWn0Dpt35MoAdgrgxNlHaX Kmj6vc+ZspR8WjUMYnjhpQGO1o4kMczYw2FPXAttTKO3xMC8BjwTnlktZMXau7gQw+sP 56TB8OcrRJcFxu0e01xPCS/qR/MzkoIUSscXenhJ/fi4wEJjVWwZCvcCOKkeBynx3Ahp F8dXGIWBmQ7llKCrv4iSvl51tA/cUzoEz186fvGp7Ym07R/ejIHI4Rkdi4rOvYTSZ8jm bf7Zog5UW0YatyVgoN61lQt6OTj4UyVHXl5GAMrewEoQdtls5/Z2Gbm6qyds1isSYd2g s9xA== 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 header.b=42u01Ivv; 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 l186-20020a6388c3000000b004ab956f62fesi3565416pgd.821.2023.01.07.03.37.38; Sat, 07 Jan 2023 03:37:51 -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 header.b=42u01Ivv; 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 + 99 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 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?1750926046476481233?= X-GMAIL-MSGID: =?utf-8?q?1754363562672382968?= 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);