[linux-next,v3,3/4] sched/psi: update rtpoll_next_update after update triggers and rtpoll_total
Message ID | 202310101642598576993@zte.com.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> 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 <rfc822;rua109.linux@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <linux-kernel@vger.kernel.org>; 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: <ZST/WggW4hSVs9d4@gmail.com> References: CAJuCfpFabCn8gcuLV322RKC=xzVm0C+64HQP+CkFNJZ4VO42ZA@mail.gmail.com,202310101109350209198@zte.com.cn,ZST/WggW4hSVs9d4@gmail.com Mime-Version: 1.0 From: <yang.yang29@zte.com.cn> To: <mingo@kernel.org>, <surenb@google.com>, <peterz@infradead.org>, <hannes@cmpxchg.org> Cc: <mingo@redhat.com>, <linux-kernel@vger.kernel.org>, <juri.lelli@redhat.com> 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?= Content-Type: text/plain; charset="UTF-8" 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: <linux-kernel.vger.kernel.org> 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 |
Series |
sched/psi: Optimize the process of updating triggers and rtpoll_total
|
|
Commit Message
Yang Yang
Oct. 10, 2023, 8:42 a.m. UTC
From: Yang Yang <yang.yang29@zte.com.cn> 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 <yang.yang29@zte.com.cn> Suggested-by: Suren Baghdasaryan <surenb@google.com> --- kernel/sched/psi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Tue, Oct 10, 2023 at 1:43 AM <yang.yang29@zte.com.cn> wrote: > > From: Yang Yang <yang.yang29@zte.com.cn> > > 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 <yang.yang29@zte.com.cn> > Suggested-by: Suren Baghdasaryan <surenb@google.com> I believe Ingo's version at https://lore.kernel.org/all/ZScQZLTssSfq19Jm@gmail.com/ already includes this change. > --- > 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, > -- > 2.25.1
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,