From patchwork Tue Oct 10 08:31:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yang X-Patchwork-Id: 15138 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp42977vqb; Tue, 10 Oct 2023 01:31:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGBiCreOdn6l8ZFrrxcL9Ol/1Mu3UWQUBCi6xCaDiloUkSRVFEQ2PQ8lviZ3vDymbwbOgrg X-Received: by 2002:a05:6808:1a1c:b0:3ae:16b6:6346 with SMTP id bk28-20020a0568081a1c00b003ae16b66346mr22224774oib.7.1696926705348; Tue, 10 Oct 2023 01:31:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696926705; cv=none; d=google.com; s=arc-20160816; b=LH0FEE9lkgqYjVvve1AxV2NvfED2+A4RHIgDjNpJ4qMmlo58cz6Qnu7j29ZedMuP+4 GeSF0zPA+68btYEBMjBCj3occR7JlWP34L9d16oAdH0JHYvUTjHH7CLzT1PpzNFFag71 EK4dAZUHX3wm0Mju/VvkcsELy6CxjcG+iNWLSnMgTETYrIKNbga+8E1eL1K0rNLAgPH7 Ovj2bwsMc1F6byaEQ0u6YAxKAoHtB75xfIJt2uCZVB74QHG5Gr5XpKPoKzMEjSrlCtVY rYz3eEmvrpBSfjbtf+FQQOY0X/43RAZ/WXT6+6W0pnGQamkdZUrvXWcZPz8tWgKjGHMa s/pw== 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=ht4D7O/4bgpLaRiLJy5ODP+I5/M25MfsEEfPIOaUuag=; fh=P1Be0mhPXrh3Y0w+jDWaRBcE7E3uPVE+GmHjwBK8Qd0=; b=FyS7jtGF5UAD1lh+9uXl0+D6ksX5MB8Gtjxxsf92IVDkxZay2YN9SXjJ7q2uesyBM9 PB4/U/lO+7cyZKjqL+78iYkZ01PasXy1YZUA1R1AKNfKm2hb6swkPysfVCZCQ71afO1U mHdZOSI+lVm9N4HVkoZtCECuLw6pkl6wB3Y9NJNrrSufp8vQDBqfVgjnYfjMrdXpxDvt y1bAmSwpIjKr7fiJ+OBlZAh22iKgzZgYCycCxT1aQs4W/JQBxUqC7/tnUy4HJfTH6Mg5 DA+Ghqs5xu4rV5szJbfh6XIl9t+6N8a90qYik5eZOo8sCjVJfHfKqqMkQOSL5YOiycsp ERWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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. [23.128.96.34]) by mx.google.com with ESMTPS id t33-20020a634461000000b00577d99bd05esi7353309pgk.743.2023.10.10.01.31.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 01:31:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 5C6C4802891D; Tue, 10 Oct 2023 01:31:43 -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 S1442868AbjJJIbX (ORCPT + 20 others); Tue, 10 Oct 2023 04:31:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442836AbjJJIbV (ORCPT ); Tue, 10 Oct 2023 04:31:21 -0400 Received: from mxct.zte.com.cn (mxct.zte.com.cn [183.62.165.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 075EDB0 for ; Tue, 10 Oct 2023 01:31:16 -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 4S4TdF6FVpz4xVby; Tue, 10 Oct 2023 16:31:13 +0800 (CST) Received: from szxlzmapp05.zte.com.cn ([10.5.230.85]) by mse-fl1.zte.com.cn with SMTP id 39A8V2HC025773; Tue, 10 Oct 2023 16:31:02 +0800 (+08) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (szxlzmapp01[null]) by mapi (Zmail) with MAPI id mid14; Tue, 10 Oct 2023 16:31:04 +0800 (CST) Date: Tue, 10 Oct 2023 16:31:04 +0800 (CST) X-Zmail-TransId: 2b0365250bc8ffffffff979-7b511 X-Mailer: Zmail v1.0 Message-ID: <202310101631048535793@zte.com.cn> In-Reply-To: References: CAJuCfpFabCn8gcuLV322RKC=xzVm0C+64HQP+CkFNJZ4VO42ZA@mail.gmail.com,202310101109350209198@zte.com.cn,ZST/WggW4hSVs9d4@gmail.com Mime-Version: 1.0 From: To: , , , Cc: , , Subject: =?utf-8?q?=5BPATCH_linux-next_v3_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 39A8V2HC025773 X-Fangmail-Gw-Spam-Type: 0 X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 65250BD1.009/4S4TdF6FVpz4xVby 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: 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:31:43 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779356617228343222 X-GMAIL-MSGID: 1779356617228343222 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 ---------- v2->v3: ---------- (1) revert #1 patch to the same as: e03dc9fa0663 ("sched/psi: Change update_triggers() to a 'void' function") (2) remake the remaining patches on top of that #1 patch ---------- (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(-) --- 2.25.1