From patchwork Wed Oct 11 21:20:46 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: 151559 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp821981vqb; Wed, 11 Oct 2023 14:21:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE932eB9E4rCoWtbZktD7m4S8QiMk6ubmQ3TbOKIZIIIxNibw3HMRRMLGVvyCL+G40WpSqt X-Received: by 2002:a05:6a20:7d85:b0:163:57ba:2ad4 with SMTP id v5-20020a056a207d8500b0016357ba2ad4mr26890934pzj.2.1697059283648; Wed, 11 Oct 2023 14:21:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697059283; cv=none; d=google.com; s=arc-20160816; b=IOY2tnCxcajbnwbQDMTQGzr0JGYBW/hgTKS16vhkVA2kF8HrgEnNgwCDARN2cfyK+Z d1mxaADf9v6ekA/Jz+kcCEcIDWnpLbCh50pIWa1UiliKNkU68Gk0bvLR8w5A+OO7ArZZ sUEO40ttIjEkA8SnulhnQ0kJ3OsuoPtfsXhbIAXCP2AccUXwxQOd14sBf6t7lv9rkJ8Y qf3NpG3DX0rEaP+uRkDnDcOT2W2kIqEe1P1Fje8Iih+fXEBei3x/S45JTw1OFftxYDvY o/vl3+PtS9WJXprwnHwk7bSJgrILCxhE3AhhJPSUaRPvJnCB8pHrGQxpuQcPSKG23tvR 9i/Q== 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=voP3sbCfwCBN19eF5CDpSusKb/FwsQSqPHHNUWe4GVw=; fh=yuboQ46Aw21UJWWE9S0jvHrNpdwNfyhQD5F6w/I8NHA=; b=OULsW2PHTJ+5wSrjkWiKY/bgp3Pl7a8MXlTEBeqKHRcBl+C5Sm3NPC05cMZFfXPHkU 77yv+3NhxtqCKCsousfBSfA6ov5/6j3onDLM0exNA2LY/OmkzyLdelDfVS/RjTNdZTAv Yn80NwsXglSfv6gFHLi0WEcwEn1r+lAPtyA0G0okEUKSN/EGmYuP82qu/9+ybGoq2iHx q4bNtkTNIwW9M9q5OuP3tVkndJxTJPJZ4l5KPtRSOD6YNwHCOkFGclgOvNfqYwsnaYR4 RyJsHgoTNh8BA01czmokT0ZAmPo+h4163go1IZJmB1UYQWeX38nMXJI/FmHQMvbNsxpJ Qsfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=WWeztrlV; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="86Ouan/J"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id w12-20020a170902e88c00b001bb02e4b739si629167plg.475.2023.10.11.14.21.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 14:21:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=WWeztrlV; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="86Ouan/J"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 29060801B9F6; Wed, 11 Oct 2023 14:21:21 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233481AbjJKVUy (ORCPT + 18 others); Wed, 11 Oct 2023 17:20:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233616AbjJKVUu (ORCPT ); Wed, 11 Oct 2023 17:20:50 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B6B2C6; Wed, 11 Oct 2023 14:20:49 -0700 (PDT) Date: Wed, 11 Oct 2023 21:20:46 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1697059247; 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=voP3sbCfwCBN19eF5CDpSusKb/FwsQSqPHHNUWe4GVw=; b=WWeztrlVbSwiIc6ZhvmtI/xoK11cepau11p9AcbtfX4AfmspC/Da3yadUO4bDHBOOff9Xa MXKt4KhkNG06wZ5K6eq/JsgjAMd+4OEOlBEJwCQn0CU4y3XM1l6vnxGaxrPKfSpSfJLi4D A+zGkpQL6Wq8pZVQBDr47iOgzEqLuiN0iL88s9I/z0CuFmQbt6LQfoauwX1M69XYKtLzZp P+uEj4ajVqfjd2oAa4Uxk4L4UnjYVvTINqE/I7AE1t4I4ALReBCvP/fO+YCiNXGi5NmF3/ i/80kAF3oEUOyPiwo4oAbV1lPE1xTjzAQ19xUcQil+pUx/LBHp7rntBQXh1Kbg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1697059247; 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=voP3sbCfwCBN19eF5CDpSusKb/FwsQSqPHHNUWe4GVw=; b=86Ouan/J2Scqx9ZY/L2t60CqJAirjq2Teagr+ceGhqrhJlRRDpDCGXT5btzQE2T3O2TcAh 0SdaZS/+AD6+E0Aw== From: "tip-bot2 for Yang Yang" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/psi: Avoid updating PSI triggers and ->rtpoll_total when there are no state changes Cc: Yang Yang , Ingo Molnar , Johannes Weiner , Suren Baghdasaryan , Peter Ziljstra , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <202310101641075436843@zte.com.cn> References: <202310101641075436843@zte.com.cn> MIME-Version: 1.0 Message-ID: <169705924655.3135.2049174551799896356.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 11 Oct 2023 14:21:21 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779495635592271266 X-GMAIL-MSGID: 1779495635592271266 The following commit has been merged into the sched/core branch of tip: Commit-ID: 80cc1d1d5ee35701daf11725ce06d8a240588973 Gitweb: https://git.kernel.org/tip/80cc1d1d5ee35701daf11725ce06d8a240588973 Author: Yang Yang AuthorDate: Tue, 10 Oct 2023 16:41:07 +08:00 Committer: Ingo Molnar CommitterDate: Wed, 11 Oct 2023 23:07:50 +02:00 sched/psi: Avoid updating PSI triggers and ->rtpoll_total when there are no state changes When psimon wakes up and there are no state changes for ->rtpoll_states, it's unnecessary to update triggers and ->rtpoll_total because the pressures being monitored by the user have not changed. This will help to slightly reduce unnecessary computations of PSI. [ mingo: Changelog updates ] Signed-off-by: Yang Yang Signed-off-by: Ingo Molnar Cc: Johannes Weiner Cc: Suren Baghdasaryan Cc: Peter Ziljstra Link: https://lore.kernel.org/r/202310101641075436843@zte.com.cn --- kernel/sched/psi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c index be853f2..79f8db0 100644 --- a/kernel/sched/psi.c +++ b/kernel/sched/psi.c @@ -704,11 +704,12 @@ static void psi_rtpoll_work(struct psi_group *group) } if (now >= group->rtpoll_next_update) { - update_triggers(group, now, &update_total, PSI_POLL); - group->rtpoll_next_update = now + group->rtpoll_min_period; - if (update_total) + if (changed_states & group->rtpoll_states) { + update_triggers(group, now, &update_total, PSI_POLL); memcpy(group->rtpoll_total, group->total[PSI_POLL], sizeof(group->rtpoll_total)); + } + group->rtpoll_next_update = now + group->rtpoll_min_period; } psi_schedule_rtpoll_work(group,