From patchwork Tue Oct 10 08:36:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yang X-Patchwork-Id: 150568 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp46012vqb; Tue, 10 Oct 2023 01:38:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHVRRflj//WQ8puAudt06qh3Gfwnuz35Mspq1wOWVVNRDOUyqYFvPknN24ghKFtkW0XvfCM X-Received: by 2002:a05:6a00:190d:b0:68f:dfda:1814 with SMTP id y13-20020a056a00190d00b0068fdfda1814mr19768923pfi.18.1696927110055; Tue, 10 Oct 2023 01:38:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696927110; cv=none; d=google.com; s=arc-20160816; b=ljyMRywE42GEW1S9E6fzxw+OzrBzfXdNt2IsWMoTfxt9h+Wnz2MAcs3HJepGuEyUdQ Q2fmxoPHS/8OR30jyMaSeXDn5ZnHUmER24IiAhv8B9ZULA5t1A+TNP6XVBNr2hSdkMOe tLfTfDLBCVwEaVBaG+ArqTZTtm0kEGSM1n3AEsBl+u9NkgFbURoNRJHKaQO3NJuL8dLf SaNbDHdDMlz5kexec61a6YxqXk0D2Bn0OuPFua9gPQdv+QZarTgN5VJ7KEeRW154VC+5 5AAzA/ETgSnmSL/eNkcOzg8FJcrIOlibmHONfANK/gw8kKJr+k0eNWiREs/eGBpIouRU 0zbg== 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=Ib3fAsZ/9pOK9PHO1wkUkzrk3QH6DIU3C/WYKNfVIyw=; fh=P1Be0mhPXrh3Y0w+jDWaRBcE7E3uPVE+GmHjwBK8Qd0=; b=FoEzBvtbl48WEpAwh5ugYn6E2vvz7crVvH5AH4s2TyZYI2GobOvWA1a7OtoDfZWVEW dPT3UK605HyrKMza3yelFi/8lwva7KSvzRaWHa0k3nX0zK8rV2xgCeiQpmPKeHldTzlV E26KjlFXFoiE52WyAyJFj4iSIIhPGTWGlwkvTMd4VWOBGIdU5ygM5dakZxGBbzkMk59/ G5j3tOZ2qNBcnGsu6X8KilOxCoMCY38UZ7n22g6P0dJ6x5xdPhy636ZLkr21NKZ4xO0z IDIPC5RdFCX4rqpwd5NdutP+aVKX1Dm03Fh1jArwLv/5n9SnObEatzdYWQI/So3sxI1+ RO1g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id by12-20020a056a00400c00b00691016ba9bcsi8968646pfb.14.2023.10.10.01.38.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 01:38:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 7358F8092EFE; Tue, 10 Oct 2023 01:38:29 -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 S233256AbjJJIiU (ORCPT + 20 others); Tue, 10 Oct 2023 04:38:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232663AbjJJIiE (ORCPT ); Tue, 10 Oct 2023 04:38:04 -0400 Received: from mxct.zte.com.cn (mxct.zte.com.cn [183.62.165.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20FBD211C for ; Tue, 10 Oct 2023 01:36:50 -0700 (PDT) Received: from mse-fl2.zte.com.cn (unknown [10.5.228.133]) (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 4S4Tlg3vtrz4xVbp; Tue, 10 Oct 2023 16:36:47 +0800 (CST) Received: from szxlzmapp05.zte.com.cn ([10.5.230.85]) by mse-fl2.zte.com.cn with SMTP id 39A8aWbm002933; Tue, 10 Oct 2023 16:36:32 +0800 (+08) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (szxlzmapp05[null]) by mapi (Zmail) with MAPI id mid14; Tue, 10 Oct 2023 16:36:34 +0800 (CST) Date: Tue, 10 Oct 2023 16:36:34 +0800 (CST) X-Zmail-TransId: 2b0765250d12ffffffffdd9-60ac7 X-Mailer: Zmail v1.0 Message-ID: <202310101636345668937@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_1/4=5D_sched/psi=3A_Change_update?= =?utf-8?q?=5Ftriggers=28=29_to_a_=27void=27_function?= X-MAIL: mse-fl2.zte.com.cn 39A8aWbm002933 X-Fangmail-Gw-Spam-Type: 0 X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 65250D1F.000/4S4Tlg3vtrz4xVbp 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:38:29 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779336387280021177 X-GMAIL-MSGID: 1779357041226302139 From: Yang Yang Update_triggers() always returns now + group->rtpoll_min_period, and the return value is only used by psi_rtpoll_work(), so change update_triggers() to a void function, let group->rtpoll_next_update = now + group->rtpoll_min_period directly. This will avoid unnecessary function return value passing & simplifies the function. Suggested-by: Suren Baghdasaryan Signed-off-by: Yang Yang Acked-by: Suren Baghdasaryan --- kernel/sched/psi.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c index 1d0f634725a6..be853f227e40 100644 --- a/kernel/sched/psi.c +++ b/kernel/sched/psi.c @@ -434,7 +434,7 @@ static u64 window_update(struct psi_window *win, u64 now, u64 value) return growth; } -static u64 update_triggers(struct psi_group *group, u64 now, bool *update_total, +static void update_triggers(struct psi_group *group, u64 now, bool *update_total, enum psi_aggregators aggregator) { struct psi_trigger *t; @@ -503,8 +503,6 @@ static u64 update_triggers(struct psi_group *group, u64 now, bool *update_total, /* Reset threshold breach flag once event got generated */ t->pending_event = false; } - - return now + group->rtpoll_min_period; } static u64 update_averages(struct psi_group *group, u64 now) @@ -706,7 +704,8 @@ static void psi_rtpoll_work(struct psi_group *group) } if (now >= group->rtpoll_next_update) { - group->rtpoll_next_update = update_triggers(group, now, &update_total, PSI_POLL); + update_triggers(group, now, &update_total, PSI_POLL); + group->rtpoll_next_update = now + group->rtpoll_min_period; if (update_total) memcpy(group->rtpoll_total, group->total[PSI_POLL], sizeof(group->rtpoll_total)); 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, From patchwork Tue Oct 10 08:42:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yang X-Patchwork-Id: 150572 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp48017vqb; Tue, 10 Oct 2023 01:43:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEHpGbRKC1d1y/hQCxgmaWiwdgbieS9E3M3VULrD9h6Me9vADTZz8lmgCWweyMKvYJlc9nr X-Received: by 2002:a05:6a00:8d4:b0:68c:44ed:fb6 with SMTP id s20-20020a056a0008d400b0068c44ed0fb6mr23560305pfu.16.1696927409997; Tue, 10 Oct 2023 01:43:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696927409; cv=none; d=google.com; s=arc-20160816; b=sTmWrPLYjx0qMVKMrIpH/NwXFYaDVdsoBr/7v0vV773GcKDasOVdq7p6T57B3+EZFm IqczUaWNAIu18hntWIB8MckeIeOmtP5GqwBeJXZhq30SE+3M3MMVduqg6xF5eOSdoA2m ZALJBngxKrfE4q92X8WdxgjEiL/BXe+sX2+Mprb7izos+OySagdA7oyuf7x724ok0QIR XPJoI58a4rx2+4L0aoPoH0pXN5fZ2y81w7vN24lXKmj21FmPx7C4zk+j1jsbaOEREkl0 bHSANUPu1NaPSYUI42fdlQnPuZ9tyDTsFz6W63P90BoZO91ud8F3q9KBZmtbldEPF7Q5 9SRw== 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=QjcK9ViUAuI+FjH6k6suopZnQpSb9hmla9tuw3QrIDM=; fh=P1Be0mhPXrh3Y0w+jDWaRBcE7E3uPVE+GmHjwBK8Qd0=; b=T3pJMccappTShgOIEO8upeaBimE8VnscbaT7PDem2D+PLodTJlRwILVlGi2CdY9GKO pUpQ+KABxps/3LG4LqwJA1t0V0aeQCGFbNjXL+yD9A7+spnMg/Ri3oTAdTwy5ItMCFrO v3zjP/38ftHBXZjP/2dbSD5iez0ujSwQqalqNWir23Up20t1btUgxJFJwEaq8eOsPpvb 00GIyFjT3adFNfHs4ahAk513QUfvgGtcLLTzBMuOUZ8r5FYV+7b8yQaIwbhVBT4pEICp yciuYsChmdHBeivy9dBcr7wEQ01MebQlv7RNJyNVlVyf/UinOl/oL17sxoV85FFTVI9Q C09Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id r23-20020a632b17000000b00578afd566cesi10922128pgr.594.2023.10.10.01.43.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 01:43:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 014658027F34; Tue, 10 Oct 2023 01:43:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229887AbjJJInP (ORCPT + 20 others); Tue, 10 Oct 2023 04:43:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229619AbjJJInO (ORCPT ); Tue, 10 Oct 2023 04:43:14 -0400 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7D6D97 for ; Tue, 10 Oct 2023 01:43:12 -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 mxhk.zte.com.cn (FangMail) with ESMTPS id 4S4Ttz3mTGz4xPYj; Tue, 10 Oct 2023 16:43:07 +0800 (CST) Received: from szxlzmapp07.zte.com.cn ([10.5.230.251]) by mse-fl1.zte.com.cn with SMTP id 39A8gv4T040928; Tue, 10 Oct 2023 16:42:57 +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:42:59 +0800 (CST) Date: Tue, 10 Oct 2023 16:42:59 +0800 (CST) X-Zmail-TransId: 2b0465250e934f1-ce342 X-Mailer: Zmail v1.0 Message-ID: <202310101642598576993@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_3/4=5D_sched/psi=3A_update_rtpoll?= =?utf-8?q?=5Fnext=5Fupdate_after_update_triggers_and_rtpoll=5Ftotal?= X-MAIL: mse-fl1.zte.com.cn 39A8gv4T040928 X-Fangmail-Gw-Spam-Type: 0 X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 65250E9B.000/4S4Ttz3mTGz4xPYj X-Spam-Status: No, score=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.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 (howler.vger.email [0.0.0.0]); Tue, 10 Oct 2023 01:43:28 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779357355765303866 X-GMAIL-MSGID: 1779357355765303866 From: Yang Yang Update group->rtpoll_next_update after called update_triggers() and update rtpoll_total. This will prevent bugs if update_triggers() uses group->rtpoll_next_update in the future, and it makes more sense to set the next update time after we finished the current update. Signed-off-by: Yang Yang Suggested-by: Suren Baghdasaryan --- kernel/sched/psi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c index 143f8eb34f9d..79f8db0c6150 100644 --- a/kernel/sched/psi.c +++ b/kernel/sched/psi.c @@ -704,12 +704,12 @@ static void psi_rtpoll_work(struct psi_group *group) } if (now >= group->rtpoll_next_update) { - group->rtpoll_next_update = now + group->rtpoll_min_period; 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, From patchwork Tue Oct 10 08:45:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yang X-Patchwork-Id: 150577 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp49166vqb; Tue, 10 Oct 2023 01:46:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGAjYVMFNJKjGoSBME3WMdgDo2VVar0nN9Og9yBOAUrVaImNx0xAkdrbEWWwvwlZKoGrR/x X-Received: by 2002:a05:6a20:7286:b0:15e:7323:5c0f with SMTP id o6-20020a056a20728600b0015e73235c0fmr22023852pzk.16.1696927596195; Tue, 10 Oct 2023 01:46:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696927596; cv=none; d=google.com; s=arc-20160816; b=fac7/sqW20ckRVnTPFW81HWuTKETmaauX0r8YqaFGw4/zQbG3vv/Jo+47LwhzfmHAx ScoCoAbj9/q660+QRsTQVZMy1xzzfEaxrciVcWN2/9mATHHmrMqnW+eMKtKKEAcUfoog 2TuzBD5EBBzuUehhdh+h6anc24RynlYx+yvtv4GUrfAksv5tpJgs+/QgqTrs2hGbS3q6 NRYxbkn1Hw4zxCYhq0b3rcb3EjuJj7ShSq7ILJkUCS1leRxehhIdbgwppb8ZmmoVcE1I 5Pg94SCb4jkijHqL/E0M9f7w0CWH2S427h/v7LE8W2eNA4Qy/57JzXdeotin/8MhNlZ3 gFwQ== 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=Oua3NXj48WW4n1+zO9ED9XrvXDdI3ZgTl7eCGtsZ/Os=; fh=P1Be0mhPXrh3Y0w+jDWaRBcE7E3uPVE+GmHjwBK8Qd0=; b=B7tdYef0SEFLakzt3LVTUS48n5bumEIVr2B9nQxeT1+0a7J9J0uQNU0tqxCx9ZREBT LDEXS1cHMJWFiOzS+3AYTIjuTlQt5XizVhNIOf/1OeWFNI0Y9YeHmRVD//cNsOikOF/v Dyio1lf5QaFQPa5COn9LNnlQjY0KzK9v8ktas2BnviBqYu+payXy7pX0LrmFmX1DLQcZ i5jMojAwvat7T0F/qwFWARNxopKrJqd9jkEOL63RpkE962ZFfwUC9Jzc6nwddeoqj3z8 D7pkI18eadS79U66HEOisnvA539EI3aypGbbQDZgbagvfK2M2h+Lqyzge9619d7J/knt AXFw== 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 h3-20020a170902680300b001c747cafce9si936836plk.231.2023.10.10.01.46.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 01:46:36 -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 BEE5F80C5F9A; Tue, 10 Oct 2023 01:46:13 -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 S229925AbjJJIqD (ORCPT + 20 others); Tue, 10 Oct 2023 04:46:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229918AbjJJIqA (ORCPT ); Tue, 10 Oct 2023 04:46:00 -0400 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 798CBB6 for ; Tue, 10 Oct 2023 01:45:55 -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 mxhk.zte.com.cn (FangMail) with ESMTPS id 4S4Ty90xVgz8XrRN; Tue, 10 Oct 2023 16:45:53 +0800 (CST) Received: from szxlzmapp05.zte.com.cn ([10.5.230.85]) by mse-fl1.zte.com.cn with SMTP id 39A8jeMW045370; Tue, 10 Oct 2023 16:45:40 +0800 (+08) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (szxlzmapp05[null]) by mapi (Zmail) with MAPI id mid14; Tue, 10 Oct 2023 16:45:43 +0800 (CST) Date: Tue, 10 Oct 2023 16:45:43 +0800 (CST) X-Zmail-TransId: 2b0765250f37ffffffffa05-766dd X-Mailer: Zmail v1.0 Message-ID: <202310101645437859599@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_4/4=5D_sched/psi=3A_Delete_the_fun?= =?utf-8?q?ction_parameter_update=5Ftotal_of?= =?utf-8?q?_update=5Ftriggers=28=29?= X-MAIL: mse-fl1.zte.com.cn 39A8jeMW045370 X-Fangmail-Gw-Spam-Type: 0 X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 65250F41.000/4S4Ty90xVgz8XrRN 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:46:13 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779357551361129529 X-GMAIL-MSGID: 1779357551361129529 From: Yang Yang The parameter update_total in update_triggers() is useless after patch "sched/psi: Avoid update triggers and rtpoll_total when it is unnecessary". If changed_states & group->rtpoll_states is true, new_stall in update_triggers() will be true, then update_total should also be true. We have no need for update_total to help judgment whether to update rtpoll_total, so delete it. This makes the code cleaner & simpler. Signed-off-by: Yang Yang Acked-by: Suren Baghdasaryan --- kernel/sched/psi.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c index 79f8db0c6150..44a78774ae87 100644 --- a/kernel/sched/psi.c +++ b/kernel/sched/psi.c @@ -434,14 +434,13 @@ static u64 window_update(struct psi_window *win, u64 now, u64 value) return growth; } -static void update_triggers(struct psi_group *group, u64 now, bool *update_total, +static void update_triggers(struct psi_group *group, u64 now, enum psi_aggregators aggregator) { struct psi_trigger *t; u64 *total = group->total[aggregator]; struct list_head *triggers; u64 *aggregator_total; - *update_total = false; if (aggregator == PSI_AVGS) { triggers = &group->avg_triggers; @@ -471,14 +470,6 @@ static void update_triggers(struct psi_group *group, u64 now, bool *update_total * events without dropping any). */ if (new_stall) { - /* - * Multiple triggers might be looking at the same state, - * remember to update group->polling_total[] once we've - * been through all of them. Also remember to extend the - * polling time if we see new stall activity. - */ - *update_total = true; - /* Calculate growth since last update */ growth = window_update(&t->win, now, total[t->state]); if (!t->pending_event) { @@ -563,7 +554,6 @@ static void psi_avgs_work(struct work_struct *work) struct delayed_work *dwork; struct psi_group *group; u32 changed_states; - bool update_total; u64 now; dwork = to_delayed_work(work); @@ -582,7 +572,7 @@ static void psi_avgs_work(struct work_struct *work) * go - see calc_avgs() and missed_periods. */ if (now >= group->avg_next_update) { - update_triggers(group, now, &update_total, PSI_AVGS); + update_triggers(group, now, PSI_AVGS); group->avg_next_update = update_averages(group, now); } @@ -638,7 +628,6 @@ static void psi_rtpoll_work(struct psi_group *group) { bool force_reschedule = false; u32 changed_states; - bool update_total; u64 now; mutex_lock(&group->rtpoll_trigger_lock); @@ -705,7 +694,7 @@ static void psi_rtpoll_work(struct psi_group *group) if (now >= group->rtpoll_next_update) { if (changed_states & group->rtpoll_states) { - update_triggers(group, now, &update_total, PSI_POLL); + update_triggers(group, now, PSI_POLL); memcpy(group->rtpoll_total, group->total[PSI_POLL], sizeof(group->rtpoll_total)); }