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));