From patchwork Tue Oct 10 08:41:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yang X-Patchwork-Id: 150570 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp47346vqb; Tue, 10 Oct 2023 01:41:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHM33/s5TZzAVOk8C/YdoeVXg9AjGu6drXju4kpcq5hgem+NbFqpkl5ehnXVmYuPl2cIaOt X-Received: by 2002:a05:6a21:a586:b0:16b:bbca:4a5d with SMTP id gd6-20020a056a21a58600b0016bbbca4a5dmr9838087pzc.62.1696927313458; Tue, 10 Oct 2023 01:41:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696927313; cv=none; d=google.com; s=arc-20160816; b=H0FCvIHnxbKtr462/T6hbhzPl6YCDFozJ7r9cftcet4d52ufP1ygrfCOj5EIMm0zvE poCopqP/xDT8MvruH99FW2ldVuWI/ARObit/HL6b1p5sFn10YOQ4RHcnRM0HwicnOVuk bf5r3tqWs+u8Em8NckYn3O5FS2DZ2eCxlbSwT5hPwN5vm9Tsa2fJtMrvEUdpagVq3ynV oQY4fmnkHCRspOQtLbvg6I98oMQqju0rDjFNiYp5hKttGHzTYsvncVIg/yTLHVElWNA/ QCstMYbZgje/D9VdJsyCmUO780ujpaNq3jiCmEGirthOmBNyK0vsA2w9EOusGA2ais08 w4aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:mime-version:references :in-reply-to:message-id:date; bh=rOb8ILo6pQZ8USk/qmdg8jlai7R0kGZv3vF1vREfADM=; fh=Pxs9OYgLaqfGHLffXBxFlX9cWm93gqtjC9dMGI2r+W0=; b=A5eakpuHLuU3bQKAg5WoRPjvghfXORjAQUw3tHcOmZlxIryJASs8B4QGPc7CuHaO0w nRTAeSuKVPFTiHpE/zgUyE6DwpTieMuuKFuebkSRGg2iAsmoSThT1npwDeIjh94VPy9N ORsjfBMApLyPrUpmsxwUVycZdJn3/EK+mhzjWsSuqkZbwkil07o62fMZ4YLx67nEOKEU Zvr8fxvLLv+Z9Wz/fnJQXyrGjZHITg0S2/Hv4PyixFXyWgNCOIJROwxebIsW32m83U+f 6IuTnPagx+NGo5A/GAaZ9Eh/maaWK14fIioofckCjy8Ic4ZkENdZclaLKcuD/URqvKOL v9Ew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id u3-20020a170902b28300b001b9ed021929si5950664plr.225.2023.10.10.01.41.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 01:41:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A732D812A959; Tue, 10 Oct 2023 01:41:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229811AbjJJIl0 (ORCPT + 20 others); Tue, 10 Oct 2023 04:41:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229876AbjJJIlY (ORCPT ); Tue, 10 Oct 2023 04:41:24 -0400 Received: from mxct.zte.com.cn (mxct.zte.com.cn [183.62.165.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC212B7 for ; Tue, 10 Oct 2023 01:41:21 -0700 (PDT) Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxct.zte.com.cn (FangMail) with ESMTPS id 4S4Trt6KwHz4xVbs; Tue, 10 Oct 2023 16:41:18 +0800 (CST) Received: from szxlzmapp05.zte.com.cn ([10.5.230.85]) by mse-fl1.zte.com.cn with SMTP id 39A8f4oH037767; Tue, 10 Oct 2023 16:41:04 +0800 (+08) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (szxlzmapp02[null]) by mapi (Zmail) with MAPI id mid14; Tue, 10 Oct 2023 16:41:07 +0800 (CST) Date: Tue, 10 Oct 2023 16:41:07 +0800 (CST) X-Zmail-TransId: 2b0465250e23ffffffffc85-c9adb X-Mailer: Zmail v1.0 Message-ID: <202310101641075436843@zte.com.cn> In-Reply-To: References: CAJuCfpFabCn8gcuLV322RKC=xzVm0C+64HQP+CkFNJZ4VO42ZA@mail.gmail.com,202310101109350209198@zte.com.cn,ZST/WggW4hSVs9d4@gmail.com Mime-Version: 1.0 From: To: , , , Cc: , , Subject: =?utf-8?q?=5BPATCH_linux-next_v3_2/4=5D_sched/psi=3A_Avoid_update_t?= =?utf-8?q?riggers_and_rtpoll=5Ftotal_when_it_is_unnecessary?= X-MAIL: mse-fl1.zte.com.cn 39A8f4oH037767 X-Fangmail-Gw-Spam-Type: 0 X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 65250E2E.002/4S4Trt6KwHz4xVbs X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 10 Oct 2023 01:41:38 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779357255067851733 X-GMAIL-MSGID: 1779357255067851733 From: Yang Yang 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 user had not changed. This will help to slightly reduce unnecessary computations of psi. Signed-off-by: Yang Yang Cc: Zhang Yunkai Cc: Ran Xiaokai Signed-off-by: Yang Yang Signed-off-by: Ingo Molnar Acked-by: Suren Baghdasaryan --- kernel/sched/psi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c index be853f227e40..143f8eb34f9d 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)); + } } psi_schedule_rtpoll_work(group,