Message ID | 4515817.LvFx2qVVIh@kreacher |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2225616vqg; Mon, 31 Jul 2023 12:36:19 -0700 (PDT) X-Google-Smtp-Source: APBJJlFVs237gHi3w0g6j14/HgkIogNCDGrU38U2rNWD7piEGCK9F+zyn+7iaeNbxipOfDEdIRaM X-Received: by 2002:a17:90a:13c9:b0:267:8012:b393 with SMTP id s9-20020a17090a13c900b002678012b393mr9964293pjf.34.1690832179612; Mon, 31 Jul 2023 12:36:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690832179; cv=none; d=google.com; s=arc-20160816; b=MR7wcX5qiTkaL61aIc2vySQ6XgjkUAYrUpuMtiqPuLaPhpRzdLaFlWFP9UNRDhbxYK dtblmBrv++9gR0PeqCMEmi7RF2J9aPOAPZl/LO7Uz1tveIT165ukAArXddkFcvO0pyfs jLETBDtKpe+XSfXsVixC7EtqT2pV5eo6y6KOGV66Wb2sIKu1Ho7exBY5dJ9xm/hdrhT5 89BfO1Mi8BWpBRuXIWkYcYoV/s1mXzI4mHDfIab7AoiqcIrHu11BigH5qY3ObqRLQLM6 diyilqblEBroWheCWVbEOzWWYq6dH4T9qJj3/iUT/idYqo44sN9iZMJGPvjrGGO9ropa P3Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=UdhMWl2ygMfAll8QA9F7pEljX4Ai2nhwDjGGm3Zee1U=; fh=vcb1WTwJPUMTZX6OxkyO+5cKBEoTRHpgQZ5gmsle4eE=; b=vWPBs3jrmgFbKyZIR+Ajjo2MEHooSXyEvrYHs6zZV6dHORkYDGQk8+LFo8uNb4Di5Q N18kzhe1BiovFLDdMVH2WP1tDV0Z/bHrwGJAFPvmy4XFlFv3VYiBA8iioWjz75Qt9lVr jKzBZpGTWG7FmrWGgDvoM+D05nfYX0u27r969NrRz8jZQPp48/SMeoWrqhYbglDgf+jq dki/kr7MsJFbsqHxPDIVMwqa2hQXLhaq2o3N0+YHRsaSuDzYGjAiUwKQvBraalPnLM/2 QFeCEKan8LUrg4i01T55802IWNkvba/7BY5jYF7AQPlUZBDLjwbo5Iw56gjkZ9tJ19hx UMng== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d8-20020a17090abf8800b002682498d8c0si951043pjs.187.2023.07.31.12.36.06; Mon, 31 Jul 2023 12:36:19 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231272AbjGaTFI (ORCPT <rfc822;dengxinlin2429@gmail.com> + 99 others); Mon, 31 Jul 2023 15:05:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230049AbjGaTE5 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 31 Jul 2023 15:04:57 -0400 Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A42A1711; Mon, 31 Jul 2023 12:04:56 -0700 (PDT) Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.2.0) id 1e1f3776e05a7fc3; Mon, 31 Jul 2023 21:04:54 +0200 Authentication-Results: v370.home.net.pl; spf=softfail (domain owner discourages use of this host) smtp.mailfrom=rjwysocki.net (client-ip=195.136.19.94; helo=[195.136.19.94]; envelope-from=rjw@rjwysocki.net; receiver=<UNKNOWN>) Received: from kreacher.localnet (unknown [195.136.19.94]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id 6B8216620E2; Mon, 31 Jul 2023 21:04:54 +0200 (CEST) From: "Rafael J. Wysocki" <rjw@rjwysocki.net> To: Linux PM <linux-pm@vger.kernel.org> Cc: LKML <linux-kernel@vger.kernel.org>, Peter Zijlstra <peterz@infradead.org>, Anna-Maria Behnsen <anna-maria@linutronix.de>, Frederic Weisbecker <frederic@kernel.org>, Kajetan Puchalski <kajetan.puchalski@arm.com> Subject: [PATCH v3 0/3] cpuidle: teo: Avoid stopping scheduler tick too often Date: Mon, 31 Jul 2023 20:49:33 +0200 Message-ID: <4515817.LvFx2qVVIh@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedviedrjeeggddutdekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecujffqoffgrffnpdggtffipffknecuuegrihhlohhuthemucduhedtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkfgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepgeffhfdujeelhfdtgeffkeetudfhtefhhfeiteethfekvefgvdfgfeeikeeigfehnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucfkphepudelhedrudefiedrudelrdelgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduleehrddufeeirdduledrleegpdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhnsggprhgtphhtthhopeeipdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepphgvthgvrhiisehinhhfrhgruggvrggurdhorhhgpdhrtghpthhtoheprghnnhgrqdhmrghrihgrsehlihhnuhhtrhho nhhigidruggvpdhrtghpthhtohepfhhrvgguvghrihgtsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehkrghjvghtrghnrdhpuhgthhgrlhhskhhisegrrhhmrdgtohhm X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=6 Fuz2=6 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1772966043171321701 X-GMAIL-MSGID: 1772966043171321701 |
Series |
cpuidle: teo: Avoid stopping scheduler tick too often
|
|
Message
Rafael J. Wysocki
July 31, 2023, 6:49 p.m. UTC
Hi Folks, Patch [1/3] in this series is a v3 of this patch posted last week: https://lore.kernel.org/linux-pm/4506480.LvFx2qVVIh@kreacher/ Patch [2/3] (this is the second version of it) addresses some bail out paths in teo_select() in which the scheduler tick may be stopped unnecessarily too. Patch [3/3] replaces a structure field with a local variable (while at it) and it is the same as its previous version. According to this message: https://lore.kernel.org/linux-pm/CAJZ5v0jJxHj65r2HXBTd3wfbZtsg=_StzwO1kA5STDnaPe_dWA@mail.gmail.com/ this series significantly reduces the number of cases in which the governor requests stopping the tick when the selected idle state is shallow, which is incorrect. Thanks!
Comments
Hi Rafael, > Hi Folks, > > Patch [1/3] in this series is a v3 of this patch posted last week: > > https://lore.kernel.org/linux-pm/4506480.LvFx2qVVIh@kreacher/ > > Patch [2/3] (this is the second version of it) addresses some bail out paths > in teo_select() in which the scheduler tick may be stopped unnecessarily too. > > Patch [3/3] replaces a structure field with a local variable (while at it) > and it is the same as its previous version. > > According to this message: > > https://lore.kernel.org/linux-pm/CAJZ5v0jJxHj65r2HXBTd3wfbZtsg=_StzwO1kA5STDnaPe_dWA@mail.gmail.com/ > > this series significantly reduces the number of cases in which the governor > requests stopping the tick when the selected idle state is shallow, which is > incorrect. > > Thanks! > > I did some initial testing with this on Android (Pixel 6, Android 13). 1. Geekbench 6 +---------------------------+---------------+-----------------+ | metric | teo | teo_tick | +---------------------------+---------------+-----------------+ | multicore_score | 3320.9 (0.0%) | 3303.3 (-0.53%) | | score | 1415.7 (0.0%) | 1417.7 (0.14%) | | CPU_total_power | 2421.3 (0.0%) | 2429.3 (0.33%) | | latency (AsyncTask #1) | 49.41μ (0.0%) | 51.07μ (3.36%) | | latency (labs.geekbench6) | 65.63μ (0.0%) | 77.47μ (18.03%) | | latency (surfaceflinger) | 39.46μ (0.0%) | 36.94μ (-6.39%) | +---------------------------+---------------+-----------------+ So the big picture for this workload looks roughly the same, the differences are too small for me to be confident in saying that the score/power difference is the result of the patches and not something random in the system. Same with the latency, the difference for labs.gb6 stands out but that's a pretty irrelevant task that sets up the benchmark, not the benchmark itself so not the biggest deal I think. +---------------+---------+------------+--------+ | kernel | cluster | idle_state | time | +---------------+---------+------------+--------+ | teo | little | 0.0 | 146.75 | | teo | little | 1.0 | 53.75 | | teo_tick | little | 0.0 | 63.5 | | teo_tick | little | 1.0 | 146.78 | +---------------+---------+------------+--------+ +---------------+-------------+------------+ | kernel | type | count_perc | +---------------+-------------+------------+ | teo | too deep | 2.034 | | teo | too shallow | 15.791 | | teo_tick | too deep | 2.16 | | teo_tick | too shallow | 20.881 | +---------------+-------------+------------+ The difference shows up in the idle numbers themselves, looks like we get a big shift towards deeper idle on our efficiency cores (little cluster) and more missed wakeups overall, both too deep & too shallow. Notably, the percentage of too shallow sleeps on the performance cores has more or less doubled (2% + 0.8% -> 4.3% + 1.8%). This doesn't necessarily have to be an issue but I'll do more testing just in case. 2. JetNews (Light UI workload) +------------------+---------------+----------------+ | metric | teo | teo_tick | +------------------+---------------+----------------+ | fps | 86.2 (0.0%) | 86.4 (0.16%) | | janks_pc | 0.8 (0.0%) | 0.8 (-0.00%) | | CPU_total_power | 185.2 (0.0%) | 178.2 (-3.76%) | +------------------+---------------+----------------+ For the UI side, the frame data comes out the same on both variants but alongside better power usage which is nice to have. +---------------+---------+------------+-------+ | kernel | cluster | idle_state | time | +---------------+---------+------------+-------+ | teo | little | 0.0 | 25.06 | | teo | little | 1.0 | 12.21 | | teo | mid | 0.0 | 38.32 | | teo | mid | 1.0 | 17.82 | | teo | big | 0.0 | 30.45 | | teo | big | 1.0 | 38.5 | | teo_tick | little | 0.0 | 23.18 | | teo_tick | little | 1.0 | 14.21 | | teo_tick | mid | 0.0 | 36.31 | | teo_tick | mid | 1.0 | 19.88 | | teo_tick | big | 0.0 | 27.13 | | teo_tick | big | 1.0 | 42.09 | +---------------+---------+------------+-------+ +---------------+-------------+------------+ | kernel | type | count_perc | +---------------+-------------+------------+ | teo | too deep | 0.992 | | teo | too shallow | 17.085 | | teo_tick | too deep | 0.945 | | teo_tick | too shallow | 15.236 | +---------------+-------------+------------+ For the idle stuff here all 3 clusters shift a bit towards deeper idle but the overall miss rate is lower across the board which is perfectly fine. TLDR: Mostly no change for a busy workload, no change + better power for a UI one. The patches make sense to me & the results look all right so no big problems at this stage. I'll do more testing (including the RFC you sent out a moment ago) over the next few days and send those out as well. Short of bumping into any other problems along the way, feel free to grab this if you'd like: Reviewed-and-tested-by: Kajetan Puchalski <kajetan.puchalski@arm.com>
On Tue, Aug 1, 2023 at 11:53 PM Kajetan Puchalski <kajetan.puchalski@arm.com> wrote: > > Hi Rafael, > > > Hi Folks, > > > > Patch [1/3] in this series is a v3 of this patch posted last week: > > > > https://lore.kernel.org/linux-pm/4506480.LvFx2qVVIh@kreacher/ > > > > Patch [2/3] (this is the second version of it) addresses some bail out paths > > in teo_select() in which the scheduler tick may be stopped unnecessarily too. > > > > Patch [3/3] replaces a structure field with a local variable (while at it) > > and it is the same as its previous version. > > > > According to this message: > > > > https://lore.kernel.org/linux-pm/CAJZ5v0jJxHj65r2HXBTd3wfbZtsg=_StzwO1kA5STDnaPe_dWA@mail.gmail.com/ > > > > this series significantly reduces the number of cases in which the governor > > requests stopping the tick when the selected idle state is shallow, which is > > incorrect. > > > > Thanks! > > > > > > I did some initial testing with this on Android (Pixel 6, Android 13). > > 1. Geekbench 6 > > +---------------------------+---------------+-----------------+ > | metric | teo | teo_tick | > +---------------------------+---------------+-----------------+ > | multicore_score | 3320.9 (0.0%) | 3303.3 (-0.53%) | > | score | 1415.7 (0.0%) | 1417.7 (0.14%) | > | CPU_total_power | 2421.3 (0.0%) | 2429.3 (0.33%) | > | latency (AsyncTask #1) | 49.41μ (0.0%) | 51.07μ (3.36%) | > | latency (labs.geekbench6) | 65.63μ (0.0%) | 77.47μ (18.03%) | > | latency (surfaceflinger) | 39.46μ (0.0%) | 36.94μ (-6.39%) | > +---------------------------+---------------+-----------------+ > > So the big picture for this workload looks roughly the same, the > differences are too small for me to be confident in saying that the > score/power difference is the result of the patches and not something > random in the system. > Same with the latency, the difference for labs.gb6 stands out but that's > a pretty irrelevant task that sets up the benchmark, not the benchmark > itself so not the biggest deal I think. > > +---------------+---------+------------+--------+ > | kernel | cluster | idle_state | time | > +---------------+---------+------------+--------+ > | teo | little | 0.0 | 146.75 | > | teo | little | 1.0 | 53.75 | > | teo_tick | little | 0.0 | 63.5 | > | teo_tick | little | 1.0 | 146.78 | > +---------------+---------+------------+--------+ > > +---------------+-------------+------------+ > | kernel | type | count_perc | > +---------------+-------------+------------+ > | teo | too deep | 2.034 | > | teo | too shallow | 15.791 | > | teo_tick | too deep | 2.16 | > | teo_tick | too shallow | 20.881 | > +---------------+-------------+------------+ > > The difference shows up in the idle numbers themselves, looks like we > get a big shift towards deeper idle on our efficiency cores (little > cluster) and more missed wakeups overall, both too deep & too shallow. > > Notably, the percentage of too shallow sleeps on the performance cores has > more or less doubled (2% + 0.8% -> 4.3% + 1.8%). This doesn't > necessarily have to be an issue but I'll do more testing just in case. > > 2. JetNews (Light UI workload) > > +------------------+---------------+----------------+ > | metric | teo | teo_tick | > +------------------+---------------+----------------+ > | fps | 86.2 (0.0%) | 86.4 (0.16%) | > | janks_pc | 0.8 (0.0%) | 0.8 (-0.00%) | > | CPU_total_power | 185.2 (0.0%) | 178.2 (-3.76%) | > +------------------+---------------+----------------+ > > For the UI side, the frame data comes out the same on both variants but > alongside better power usage which is nice to have. > > +---------------+---------+------------+-------+ > | kernel | cluster | idle_state | time | > +---------------+---------+------------+-------+ > | teo | little | 0.0 | 25.06 | > | teo | little | 1.0 | 12.21 | > | teo | mid | 0.0 | 38.32 | > | teo | mid | 1.0 | 17.82 | > | teo | big | 0.0 | 30.45 | > | teo | big | 1.0 | 38.5 | > | teo_tick | little | 0.0 | 23.18 | > | teo_tick | little | 1.0 | 14.21 | > | teo_tick | mid | 0.0 | 36.31 | > | teo_tick | mid | 1.0 | 19.88 | > | teo_tick | big | 0.0 | 27.13 | > | teo_tick | big | 1.0 | 42.09 | > +---------------+---------+------------+-------+ > > +---------------+-------------+------------+ > | kernel | type | count_perc | > +---------------+-------------+------------+ > | teo | too deep | 0.992 | > | teo | too shallow | 17.085 | > | teo_tick | too deep | 0.945 | > | teo_tick | too shallow | 15.236 | > +---------------+-------------+------------+ > > For the idle stuff here all 3 clusters shift a bit towards deeper idle > but the overall miss rate is lower across the board which is perfectly > fine. > > TLDR: > Mostly no change for a busy workload, no change + better power for a UI > one. The patches make sense to me & the results look all right so no big > problems at this stage. I'll do more testing (including the RFC you sent > out a moment ago) over the next few days and send those out as well. > > Short of bumping into any other problems along the way, feel free to > grab this if you'd like: > Reviewed-and-tested-by: Kajetan Puchalski <kajetan.puchalski@arm.com> Thank you!