From patchwork Tue Oct 10 03:05:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yang X-Patchwork-Id: 15127 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp2246871vqo; Mon, 9 Oct 2023 20:06:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHanI4vv4nGjJof1T0/+aeCxjFmGjn4tWkeFnkr4lfqDlNAHN/dNhB97sKS5ldMlFXfuAUZ X-Received: by 2002:a05:6a00:2382:b0:690:d42e:c310 with SMTP id f2-20020a056a00238200b00690d42ec310mr21165884pfc.16.1696907186993; Mon, 09 Oct 2023 20:06:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696907186; cv=none; d=google.com; s=arc-20160816; b=vuJbzbH1+/6XWTk+2AEAaZdHHS11Wz6BD1zafxS5gyLDLUPuN1+BUria1fVSCzsLXp yFgn1nD0r6e2xny5BAEZIC/Y1UQhyYlByOpWSL7zVvg+jO01y+JZ/JlxhbE4MOrtXFCt lD6dEgpD2udLeRot1gH9G6NJ+euLpA78prbx7Ne3LcuMzwUed30bYPR4WTAEtmSi8UqN B+qeHHlNg+z4npWSnOt58NNP3zOvfxBP6QfEfTKQE1JR3+HSO91KHrB3HTSrLhiXTUJ9 LUFVpEJs8Al1+fduVUygSVAaXRaYgOMp3aK94S8DntAQfCexFcMqw8bQ3ENLM9HzTw7L je8Q== 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=Vef/89URDEpaFk5S5wUwe5K6LhEsVblENzXhcp9yrjI=; fh=g66mwGaaEwasfANWCPBZJhFXmC0KrsU+d88cLge1kZM=; b=J+r/AGYlN2uvyRwi4KPsO3Zxu+VwtRvDEldTXoxgDheSWpeep58b+Ch0WwQ363dy3q 4zvff+LtnaadvYjJmuvyeFAq/0lZUe8NPiDf3uI47pUSsJg5dnghvpdoPi2qr1QwoFAa M8UupUazu3UVpd8L7mt5mfqFYFvK9/nezGe2xRMEQj6Juh9I7lBM4P7azUKJMbbM4Oul j6l7CPLuhnawEqCnHZo2YhgJCG9XOfTYOBGXKP8WXRbCIzpubHiAaL0WyKKgmKT41ld3 WQIb2bRNyd/RjucdILvTGgt+hnuAfIfM+ty/W6ZKhxE6mzoBlRs4WTFvMYub3eB/wc+b a0Ew== 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 fh25-20020a056a00391900b0068fe810e8a0si8756583pfb.197.2023.10.09.20.06.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 20:06:26 -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 DB5B681068D0; Mon, 9 Oct 2023 20:06:25 -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 S1441918AbjJJDGP (ORCPT + 20 others); Mon, 9 Oct 2023 23:06:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378482AbjJJDGN (ORCPT ); Mon, 9 Oct 2023 23:06:13 -0400 Received: from mxct.zte.com.cn (mxct.zte.com.cn [183.62.165.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAAE993 for ; Mon, 9 Oct 2023 20:06:10 -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 mxct.zte.com.cn (FangMail) with ESMTPS id 4S4LQ66L5tz4xVbp; Tue, 10 Oct 2023 11:06:06 +0800 (CST) Received: from szxlzmapp01.zte.com.cn ([10.5.231.85]) by mse-fl1.zte.com.cn with SMTP id 39A35vK4078952; Tue, 10 Oct 2023 11:05:57 +0800 (+08) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (szxlzmapp03[null]) by mapi (Zmail) with MAPI id mid14; Tue, 10 Oct 2023 11:05:59 +0800 (CST) Date: Tue, 10 Oct 2023 11:05:59 +0800 (CST) X-Zmail-TransId: 2b056524bf971e2-8eea1 X-Mailer: Zmail v1.0 Message-ID: <202310101105590891853@zte.com.cn> In-Reply-To: References: ZSPayGSz6HQBp+3W@gmail.com,202310092030430136422@zte.com.cn,ZSP3cuEsgwWcIKRw@gmail.com,CAJuCfpFabCn8gcuLV322RKC=xzVm0C+64HQP+CkFNJZ4VO42ZA@mail.gmail.com Mime-Version: 1.0 From: To: , , , Cc: , , Subject: =?utf-8?q?=5BPATCH_linux-next_v2_0/4=5D_sched/psi=3A_Optimize_the_p?= =?utf-8?q?rocess_of_updating_triggers_and_rtpoll=5Ftotal?= X-MAIL: mse-fl1.zte.com.cn 39A35vK4078952 X-Fangmail-Gw-Spam-Type: 0 X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 6524BF9E.000/4S4LQ66L5tz4xVbp X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,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]); Mon, 09 Oct 2023 20:06:25 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779336150563823314 X-GMAIL-MSGID: 1779336150563823314 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 have not changed. This will help to slightly reduce unnecessary computations of psi. There are also some minor related optimizations, please see below. Update_triggers() always return 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. 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. The parameter update_total in update_triggers() is useless now. Since if changed_states & group->rtpoll_states is true, new_stall in update_triggers() will be true, then update_total should also be true. We have no need for update_total to help judgment whether to update rtpoll_total, so delete update_total. Change log ---------- v1->v2: ---------- (1) the line number of group->rtpoll_next_update in patch 1 remain unchanged (2) split patch 3 from patch 2 Yang Yang (4): sched/psi: Change update_triggers() to a void function sched/psi: Avoid update triggers and rtpoll_total when it is unnecessary sched/psi: Update rtpoll_next_update after update triggers and rtpoll_total sched/psi: Delete the function parameter update_total of update_triggers() kernel/sched/psi.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-)