Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp1089900rdg; Wed, 11 Oct 2023 14:15:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IERmV0jjnyscmBAycRDWUJOBPTG6bY6rgCqcRnheT1KUC0fLxSyxMVGdGI8To/xV432tovJ X-Received: by 2002:a17:902:ce8b:b0:1bc:7441:d81a with SMTP id f11-20020a170902ce8b00b001bc7441d81amr24065631plg.6.1697058958534; Wed, 11 Oct 2023 14:15:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697058958; cv=none; d=google.com; s=arc-20160816; b=iu3u4oU797YqrMtET2E+H1Y92EYg9WD4S5oitZpTvgu8Z4bdijut7tzR+0b4G90Qd4 H1NsBDw8ngDIPSXwIi4WnYCOxUlDFWu6VD0/3j/B0omkHOdEjktfmsCoTn9UaOo8Ljvw uQ7kx60YBqZhZlci6Em/Uh4NkmH5PU0SuXUwinZXWbp1s/JKb1Qbyi1ds+ewbD3tsN3k TUaWmN2a3FT/b8VSHLm/+F2P6JPYYYv7opnZuLbp8OGdMquZN5Iq/wmtlxsE6qGVKsZ2 6r4iwZcNtecxeffN3ZCWPTjkO+FC+82M34ymSPBrCJjq5/1XCm42Z6O0PbnIp+jyt1Bi gD8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=hJF0NDc8Mcux/Il97ezd+yJcINMhCT6dKRS+JP02R0E=; fh=qw8B0eh6uhP6HgJkolZKBBM3SgUUZTbKgtqT3kgu9M0=; b=kcbSi9LPAXgRv6iXjeClIrx7vTV0ycrnv31BS/0Rpp75vy0nz6VRZe6SlKVQ0vGnkc HqnUuj5gOLdKLLAd6+EOsviWdLvC49VCcdrrSUZ30sR7I9v0Tl/y3ikmV3PMh8i+vLJu jc5a69ke7lqOFHyHDxrxBLzYudRdG9B+ZxZ0rniakMJ+5BmoO6i+cqBvRGXhiDCZwS4r VYTBfBl/CSFz3bjHkPlehakKR30Zu6Kf2vFVa8582LryJhiYSOHESIXc4wptZjB2Lu1B LlZWfhbUIxs+32wRwiqN2+NfydMvCr9OVUsbhWvgdRxMoJZzercZDUbr8CtzxvSOClO2 33NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=O13ydFKn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id h4-20020a170902680400b001c35864fdbbsi493959plk.406.2023.10.11.14.15.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 14:15:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=O13ydFKn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 15BD48068E1F; Wed, 11 Oct 2023 14:15:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233520AbjJKVP0 (ORCPT + 99 others); Wed, 11 Oct 2023 17:15:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233525AbjJKVPX (ORCPT ); Wed, 11 Oct 2023 17:15:23 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0378790 for ; Wed, 11 Oct 2023 14:15:21 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-9ada2e6e75fso45547466b.2 for ; Wed, 11 Oct 2023 14:15:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697058919; x=1697663719; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=hJF0NDc8Mcux/Il97ezd+yJcINMhCT6dKRS+JP02R0E=; b=O13ydFKnoys4C4MLCb60GIRjJOjMRezTEHfgHl4HJ9vG7EGbufHrc7FneCbtZbWlyR jbws4iqu5CpJJ9Co2JfnDnOAWt6cINVTnu1MFY/zr85F3hiznVvpo0ra8aWtvc6Aku/S LwPAbD+rWLgF/+g+VlmnauwGk7qpReZfb4/VA0nirUHT6isnkNYMb26H1UWCrm/TIKsr L5EIVEupfQu/ePAac7d76bruK0M6/2KLIGIEf9gHc2+qdiN3SBwxQ6w5knRfshI19ZQU UsBGY0kur4JG2l2QdENOocFUoo35iyL6oTSl/eBb1JyC45QedImNAOKEbIodx3FQeNCZ oJoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697058919; x=1697663719; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hJF0NDc8Mcux/Il97ezd+yJcINMhCT6dKRS+JP02R0E=; b=Ri00tBC59ZApAS6ZXSvzcMDA16jZMYNhhXypuQWw9cezHB5MeTB6ejcsOhwtVH8tzW +kz36j2SQ9jNhaqXBujYJENAxxcC4orvisiX9Ql82lGkhFTUwg6dzF+mCYPBXz1q8itP RrhaeX5y/rYcnOL/+ZEHbf+/csJbGKRjJwuOLQdTg0cGHsBMj7UlhoA1+B+tnt50LLVw mtWvL+SHG32riS9//esbe9/9tt/AeldUDGByGTnFFd6r3maF/0t1w91LDYZRfbumT4yD fE/l0i6VK/H7/kpDNEr/7dfkm3nI747zIZi9qCTLTmlrrBl2JU0LqH5w+G1iGzlPdfsD SYOg== X-Gm-Message-State: AOJu0Yy0pjKNi1W96j6wjNkIrt7hsuh7hWHT81bhUUungvtnF3BiDsNU dKPgEGq5yOU/O5IIbJ+Woz8= X-Received: by 2002:a17:906:18b2:b0:9b2:b992:160f with SMTP id c18-20020a17090618b200b009b2b992160fmr17028101ejf.42.1697058919177; Wed, 11 Oct 2023 14:15:19 -0700 (PDT) Received: from gmail.com (1F2EF405.nat.pool.telekom.hu. [31.46.244.5]) by smtp.gmail.com with ESMTPSA id re9-20020a170906d8c900b0099b8234a9fesm10213540ejb.1.2023.10.11.14.15.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 14:15:18 -0700 (PDT) Sender: Ingo Molnar Date: Wed, 11 Oct 2023 23:15:16 +0200 From: Ingo Molnar To: yang.yang29@zte.com.cn Cc: surenb@google.com, peterz@infradead.org, hannes@cmpxchg.org, linux-kernel@vger.kernel.org, juri.lelli@redhat.com, mingo@redhat.com Subject: Re: [PATCH linux-next v3 2/4] sched/psi: Avoid update triggers and rtpoll_total when it is unnecessary Message-ID: References: <202310101641075436843@zte.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202310101641075436843@zte.com.cn> X-Spam-Status: No, score=2.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Wed, 11 Oct 2023 14:15:56 -0700 (PDT) X-Spam-Level: ** * 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 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 > --- > 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)); > + } 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 from update_triggers() I rewrote the changelogs for readability. Thanks, Ingo ===================> From: Yang Yang Date: Tue, 10 Oct 2023 16:41:07 +0800 Subject: [PATCH] sched/psi: Avoid updating PSI triggers and ->rtpoll_total 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 pressures 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 --- 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 >= 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)); + } + group->rtpoll_next_update = now + group->rtpoll_min_period; } psi_schedule_rtpoll_work(group,