Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp457922rdb; Thu, 19 Oct 2023 09:05:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFiwPlJFClFw3mB2BpBDkcc6mth0OgMpxUANBhfSNVm2kzFa2koM2n/Pbc9rydehnsCuKBN X-Received: by 2002:a17:902:c402:b0:1ca:87ea:2fcf with SMTP id k2-20020a170902c40200b001ca87ea2fcfmr3494966plk.25.1697731510625; Thu, 19 Oct 2023 09:05:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697731510; cv=none; d=google.com; s=arc-20160816; b=w2DRWSJ8TjJ9TVcUHP0Ndt4QNqMaPCf/XSqcQrGwtz10/UbptHvWb6q3c5/oRdu0EI wp2FqYDm4xLT2O58hmtzlqRZp7gEvrR7CgKOLxRTyjhkZ/N7i1e6ZMBtAvDKgruLbNkm wKmHzrgpExIMyvbwwVn7Fpe0FEdKdNzs5vKMcwa2VdrpybJBZ26zHnHaM8t02NA4QvRi F5Rg22ErsM5+angX30fWazyctMQU38t04N582NiIJwoWCeUssCQBppG7BgMlPa0v/W9v F+8GPECRHXRs7paGFRoBl2UnQViSvKLmOMUwae1y43sp0FLRMx0dt+k0bWIQ7627CYqB IETQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=FJCfgpMRGm8SsO7MCIzXVFxgcyw3Voi3ZeI75VxR5RI=; fh=5RklumPwfLc+NuCvwKpz7B6XbWfW61nyBLie0x0DSpE=; b=X1H1AVKJuniDYaH/BaKDni5l35Ss/GHWVIljWyrOT+SdGBiWsYmbomq5DXxhlzUgf9 2KeXzwQVJavAMkb++g7FDPdkCYqD+ILsDIgjnOkfbl4jAvnduYWHFo8VZwYqoUPRpBhI q5sBQZ27Mi0Vta99cQpJxt80q+D0Du5OQed30BnWil6f4gjp2/HSGiOGvtVZbMqYXawE Ws4nFqi79Qy4YK1pyVJOfXKOA+yCrgRaqS04CiI7t0XQLyeFcZ/Sq/1oZVm2l7g26RJf Qxyng/FwfHew6Z/sI6iWqNZan+vG0AFbV9Tr9uNyz86EPnDrBE/nN21XjxAt7izJZLzk CECw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=VIwrVYtl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id h12-20020a170902704c00b001bbae3ae2bcsi2448360plt.413.2023.10.19.09.05.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 09:05:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=VIwrVYtl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 5E86A81ADB74; Thu, 19 Oct 2023 09:05:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345335AbjJSQFA (ORCPT + 99 others); Thu, 19 Oct 2023 12:05:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235445AbjJSQE7 (ORCPT ); Thu, 19 Oct 2023 12:04:59 -0400 Received: from mail-yw1-x112a.google.com (mail-yw1-x112a.google.com [IPv6:2607:f8b0:4864:20::112a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05C44114 for ; Thu, 19 Oct 2023 09:04:58 -0700 (PDT) Received: by mail-yw1-x112a.google.com with SMTP id 00721157ae682-5a7af45084eso104461497b3.0 for ; Thu, 19 Oct 2023 09:04:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697731497; x=1698336297; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=FJCfgpMRGm8SsO7MCIzXVFxgcyw3Voi3ZeI75VxR5RI=; b=VIwrVYtlnOSHTbVDklPkd70WvNR2cEVQ828duGNQKvlKmhjbdlRYJjkckdjyCmmz03 /6NcnrSwCY57uggjhyuMD+Rn2ucZJ1v6IZuOuyyDvS6EgTzC9SL0ZwFks09JcxjX8Az8 6Empif8/A1jmKg+glbHm3IioIkq2mKwHF/e20G96DPVpY1lg7WQ3QsibuCKIDThUJHNB xX7d+nAgvd+3zsoxSnS2Welq/Y8oItZiw8YD3tJPwEzcBIyscjZ3rJIle873a+9Pe0TY Vo5JV6Uv0m9k49vWETiD/roNrpIFEcXioul+jVilsAeLUNoho/SHOPptVy2uERqy8Hga N2Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697731497; x=1698336297; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FJCfgpMRGm8SsO7MCIzXVFxgcyw3Voi3ZeI75VxR5RI=; b=WzqoyIDCQaciwQJkXwqUIJWKmbwCpAgvEtJ3GVCeAlZGPNiW3GB3ZaKz16o7b033Xx RnFovSzTFc/26ptURDXEaa56JdjY3sTh09dLLSmWN2+UpdRvMPrUexuh4tQccO3FYehQ RbytaGf/HMitiuWDJyD1ATymzAKJt5PJh0MA+YIqybQIkxqsxiWMdIfCbBZmqiyanzsi UnaDPMRfAthk8uugPDlGb1EYawWVq6RxmpaxoUF93Gc9n2mwaiBIVedhhCnh7tjHMU50 yqU5g4HawDJCL/hEOjBVtytAhGo0yHmNHtjwGdmCvXRiLn0EbQ1egeaDGZitxU05ci2A jL0Q== X-Gm-Message-State: AOJu0Yza72kwBb8YYbsXWWc7RrcUiBDDoFG5gYoA2VbfYfrDmhtg1bf2 126bJSe3l1x7NjlUmHxwqwDvwq1uQ7BSkXg6FrJPIQ== X-Received: by 2002:a81:498b:0:b0:5a8:2d2b:ca9c with SMTP id w133-20020a81498b000000b005a82d2bca9cmr2962189ywa.32.1697731496606; Thu, 19 Oct 2023 09:04:56 -0700 (PDT) MIME-Version: 1.0 References: <202310101641075436843@zte.com.cn> In-Reply-To: From: Suren Baghdasaryan Date: Thu, 19 Oct 2023 09:04:45 -0700 Message-ID: Subject: Re: [PATCH linux-next v3 2/4] sched/psi: Avoid update triggers and rtpoll_total when it is unnecessary To: Ingo Molnar Cc: yang.yang29@zte.com.cn, peterz@infradead.org, hannes@cmpxchg.org, linux-kernel@vger.kernel.org, juri.lelli@redhat.com, mingo@redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Thu, 19 Oct 2023 09:05:07 -0700 (PDT) On Wed, Oct 11, 2023 at 2:15=E2=80=AFPM Ingo Molnar wrot= e: > > > * yang.yang29@zte.com.cn wrote: > > > 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 pressu= res > > 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 > > --- > > 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 *gro= up) > > } > > > > if (now >=3D group->rtpoll_next_update) { > > - update_triggers(group, now, &update_total, PSI_POLL); > > group->rtpoll_next_update =3D now + group->rtpoll_min_per= iod; > > - if (update_total) > > + if (changed_states & group->rtpoll_states) { > > + update_triggers(group, now, &update_total, PSI_PO= LL); > > memcpy(group->rtpoll_total, group->total[PSI_POLL= ], > > sizeof(group->rtpoll_total)); > > + } > > Yeah, so I believe we may have been talking past each other for past > versions of this patch: why is this patch modifying the order of the > modification to group->rtpoll_next_update? > > It should do the below sequence, nothing more - see the patch attached > below. This is basically a combination of patches #2 and #3. > > And then the final patch removes the now superfluous 'update_total' > parameter, which is always true. > > Here are the commits I applied to tip:sched/core: > > e03dc9fa0663 sched/psi: Change update_triggers() to a 'void' function > ... > 80cc1d1d5ee3 sched/psi: Avoid updating PSI triggers and ->rtpoll_total = when there are no state changes > 3657680f38cd sched/psi: Delete the 'update_total' function parameter fr= om update_triggers() > > I rewrote the changelogs for readability. > > Thanks, > > Ingo > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D> > From: Yang Yang > Date: Tue, 10 Oct 2023 16:41:07 +0800 > Subject: [PATCH] sched/psi: Avoid updating PSI triggers and ->rtpoll_tota= l when there are no state changes > > When psimon wakes up and there are no state changes for ->rtpoll_states, > it's unnecessary to update triggers and ->rtpoll_total because the pressu= res > being monitored by the user have not changed. > > This will help to slightly reduce unnecessary computations of PSI. > > [ mingo: Changelog updates ] > > Signed-off-by: Yang Yang > Signed-off-by: Ingo Molnar > Cc: Johannes Weiner > Cc: Suren Baghdasaryan > Cc: Peter Ziljstra > Link: https://lore.kernel.org/r/202310101641075436843@zte.com.cn This version looks correct to me. Acked-by: Suren Baghdasaryan > --- > kernel/sched/psi.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c > index be853f227e40..79f8db0c6150 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 >=3D group->rtpoll_next_update) { > - update_triggers(group, now, &update_total, PSI_POLL); > - group->rtpoll_next_update =3D now + group->rtpoll_min_per= iod; > - if (update_total) > + if (changed_states & group->rtpoll_states) { > + update_triggers(group, now, &update_total, PSI_PO= LL); > memcpy(group->rtpoll_total, group->total[PSI_POLL= ], > sizeof(group->rtpoll_total)); > + } > + group->rtpoll_next_update =3D now + group->rtpoll_min_per= iod; > } > > psi_schedule_rtpoll_work(group,