[RESEND,linux-next] sched/psi: avoid resetting the min update period when it is unnecessary
Message ID | 202305121642367753446@zte.com.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp4942945vqo; Fri, 12 May 2023 01:43:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5GEe0ssxjbcW4IVjIUFHhSFVBwY4zcf8qSYZdmcstpbPvhFBLjQDa08IFHq3XBECNkN829 X-Received: by 2002:a05:6a00:1741:b0:646:421f:500b with SMTP id j1-20020a056a00174100b00646421f500bmr25672962pfc.10.1683881019914; Fri, 12 May 2023 01:43:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683881019; cv=none; d=google.com; s=arc-20160816; b=Rb8eZBAkHhTCwNkscbTYY8BJyYpjjydewS+AHuQB+WFCx9hmbcZs0tzJVNsIQjjw+V 7+NmRfdmHgUQVqAGSrWauESxgTdMnh7SgkcLT4V+4AtQuPkPzi5IyIwpvCvvYYWPqQde ZWaUuq0FmswRSRnaOlZoSaBxiSZuCP52JDPBLBcUQetETMoGTmKTaIf6ZQQKgdJ0kyEW IlP3BO7nAD/qV9J/WtjNvEL35s3QgSv8i8+YhcymIBYKT7tvluqHOWUIMw5p2uq5rTPo MHUExkVYb/5BlZyUkouxasNFFh9IzyMyOkGGLUGBp4iw/GKohSVv0G79UDN/DbU/FxI7 xAFA== 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:message-id:date; bh=YmWxDqt9QD8dHsmHUWspPvwZHKTpsR1gPCfmnLSGdNg=; b=nTSDopoWzknpVbZ4x7ihDgCgc23baDjkR/nv3Va2YxI6lNJZ5P4uGrungupU22JgI2 rWSbJ9PLWuhQx76o8wGrwli81HhSJT+IjTVah1u9wygzeq4tieyv4vOw/dO9tBbf9O75 g3PIIW9zK8A9fEA1iDCKMmpEBTz9ZSf8dOCQAOhEXP69tjF2KYHlVkrUkUqG2prdyZm6 SmUg7EpM8ikt7XW2HniR5MBV2BI7KH455c7cdOPJroxC+WYe9uFG8XXFsgsxSGM94go1 3/dglre9wk7r1ZJHL/+i9FAEwp40DZ18tQECnUkyUTu0UlCb4Xw3pzfZnR60N76pG74e /2xw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m1-20020a638c01000000b005300b7a7e4csi9289243pgd.145.2023.05.12.01.43.25; Fri, 12 May 2023 01:43:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239826AbjELImw (ORCPT <rfc822;peekingduck44@gmail.com> + 99 others); Fri, 12 May 2023 04:42:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232659AbjELImv (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 12 May 2023 04:42:51 -0400 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 087334682 for <linux-kernel@vger.kernel.org>; Fri, 12 May 2023 01:42:48 -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 4QHj2H0Jlwz4xVnD; Fri, 12 May 2023 16:42:47 +0800 (CST) Received: from szxlzmapp01.zte.com.cn ([10.5.231.85]) by mse-fl1.zte.com.cn with SMTP id 34C8gY0K061762; Fri, 12 May 2023 16:42:34 +0800 (+08) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (szxlzmapp07[null]) by mapi (Zmail) with MAPI id mid14; Fri, 12 May 2023 16:42:36 +0800 (CST) Date: Fri, 12 May 2023 16:42:36 +0800 (CST) X-Zmail-TransId: 2b09645dfbfcffffffffe41-05941 X-Mailer: Zmail v1.0 Message-ID: <202305121642367753446@zte.com.cn> Mime-Version: 1.0 From: <yang.yang29@zte.com.cn> To: <mingo@redhat.com>, <peterz@infradead.org>, <axboe@kernel.dk>, <tj@kernel.org> Cc: <hannes@cmpxchg.org>, <linux-kernel@vger.kernel.org>, <juri.lelli@redhat.com> Subject: =?utf-8?q?=5BRESEND_PATCH_linux-next=5D_sched/psi=3A_avoid_resettin?= =?utf-8?q?g_the_min_update_period_when_it_is_unnecessary?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl1.zte.com.cn 34C8gY0K061762 X-Fangmail-Gw-Spam-Type: 0 X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 645DFC07.000/4QHj2H0Jlwz4xVnD X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765677223998628969?= X-GMAIL-MSGID: =?utf-8?q?1765677223998628969?= |
Series |
[RESEND,linux-next] sched/psi: avoid resetting the min update period when it is unnecessary
|
|
Commit Message
Yang Yang
May 12, 2023, 8:42 a.m. UTC
From: Yang Yang <yang.yang29@zte.com.cn> Psi_group's poll_min_period is determined by the minimum window size of psi_trigger when creating new triggers. While destroying a psi_trigger, there is no need to reset poll_min_period if the psi_trigger being destroyed did not have the minimum window size, since in this condition poll_min_period will remain the same as before. Signed-off-by: Yang Yang <yang.yang29@zte.com.cn> Acked-by: Suren Baghdasaryan <surenb@google.com> --- kernel/sched/psi.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
Comments
On Fri, May 12, 2023 at 1:42 AM <yang.yang29@zte.com.cn> wrote: > > From: Yang Yang <yang.yang29@zte.com.cn> > > Psi_group's poll_min_period is determined by the minimum window size of > psi_trigger when creating new triggers. While destroying a psi_trigger, there > is no need to reset poll_min_period if the psi_trigger being destroyed did not > have the minimum window size, since in this condition poll_min_period will > remain the same as before. > > Signed-off-by: Yang Yang <yang.yang29@zte.com.cn> > Acked-by: Suren Baghdasaryan <surenb@google.com> Hi Peter, This is another psi-related patch that slipped through the cracks. Could you please take it into your tree? The original one [1] had a different title but the same code. Thanks, Suren. [1] https://lore.kernel.org/all/202304171611545861530@zte.com.cn/ > --- > kernel/sched/psi.c | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c > index 02e011cabe91..12869585cf89 100644 > --- a/kernel/sched/psi.c > +++ b/kernel/sched/psi.c > @@ -1359,11 +1359,16 @@ void psi_trigger_destroy(struct psi_trigger *t) > group->nr_triggers[t->state]--; > if (!group->nr_triggers[t->state]) > group->poll_states &= ~(1 << t->state); > - /* reset min update period for the remaining triggers */ > - list_for_each_entry(tmp, &group->triggers, node) > - period = min(period, div_u64(tmp->win.size, > - UPDATES_PER_WINDOW)); > - group->poll_min_period = period; > + /* > + * Reset min update period for the remaining triggers iff the destroying > + * trigger had the min window size. > + */ > + if (group->poll_min_period == div_u64(t->win.size, UPDATES_PER_WINDOW)) { > + list_for_each_entry(tmp, &group->triggers, node) > + period = min(period, div_u64(tmp->win.size, > + UPDATES_PER_WINDOW)); > + group->poll_min_period = period; > + } > /* Destroy poll_task when the last trigger is destroyed */ > if (group->poll_states == 0) { > group->polling_until = 0; > -- > 2.25.1
On Fri, May 12, 2023 at 10:56:02AM -0700, Suren Baghdasaryan wrote: > On Fri, May 12, 2023 at 1:42 AM <yang.yang29@zte.com.cn> wrote: > > > > From: Yang Yang <yang.yang29@zte.com.cn> > > > > Psi_group's poll_min_period is determined by the minimum window size of > > psi_trigger when creating new triggers. While destroying a psi_trigger, there > > is no need to reset poll_min_period if the psi_trigger being destroyed did not > > have the minimum window size, since in this condition poll_min_period will > > remain the same as before. > > > > Signed-off-by: Yang Yang <yang.yang29@zte.com.cn> > > Acked-by: Suren Baghdasaryan <surenb@google.com> > > Hi Peter, > This is another psi-related patch that slipped through the cracks. > Could you please take it into your tree? The original one [1] had a > different title but the same code. It does not cleanly apply to tip/sched/core; could either of you rebase please? Thanks!
On Sat, May 13, 2023 at 2:45 AM Peter Zijlstra <peterz@infradead.org> wrote: > > On Fri, May 12, 2023 at 10:56:02AM -0700, Suren Baghdasaryan wrote: > > On Fri, May 12, 2023 at 1:42 AM <yang.yang29@zte.com.cn> wrote: > > > > > > From: Yang Yang <yang.yang29@zte.com.cn> > > > > > > Psi_group's poll_min_period is determined by the minimum window size of > > > psi_trigger when creating new triggers. While destroying a psi_trigger, there > > > is no need to reset poll_min_period if the psi_trigger being destroyed did not > > > have the minimum window size, since in this condition poll_min_period will > > > remain the same as before. > > > > > > Signed-off-by: Yang Yang <yang.yang29@zte.com.cn> > > > Acked-by: Suren Baghdasaryan <surenb@google.com> > > > > Hi Peter, > > This is another psi-related patch that slipped through the cracks. > > Could you please take it into your tree? The original one [1] had a > > different title but the same code. > > It does not cleanly apply to tip/sched/core; could either of you rebase > please? Rebase is posted here: https://lore.kernel.org/all/20230514163338.834345-1-surenb@google.com/ Thanks! > > Thanks!
diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c index 02e011cabe91..12869585cf89 100644 --- a/kernel/sched/psi.c +++ b/kernel/sched/psi.c @@ -1359,11 +1359,16 @@ void psi_trigger_destroy(struct psi_trigger *t) group->nr_triggers[t->state]--; if (!group->nr_triggers[t->state]) group->poll_states &= ~(1 << t->state); - /* reset min update period for the remaining triggers */ - list_for_each_entry(tmp, &group->triggers, node) - period = min(period, div_u64(tmp->win.size, - UPDATES_PER_WINDOW)); - group->poll_min_period = period; + /* + * Reset min update period for the remaining triggers iff the destroying + * trigger had the min window size. + */ + if (group->poll_min_period == div_u64(t->win.size, UPDATES_PER_WINDOW)) { + list_for_each_entry(tmp, &group->triggers, node) + period = min(period, div_u64(tmp->win.size, + UPDATES_PER_WINDOW)); + group->poll_min_period = period; + } /* Destroy poll_task when the last trigger is destroyed */ if (group->poll_states == 0) { group->polling_until = 0;