From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A13D5C2D0E4 for ; Fri, 27 Nov 2020 10:53:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 42171208B3 for ; Fri, 27 Nov 2020 10:53:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727039AbgK0Kx0 (ORCPT ); Fri, 27 Nov 2020 05:53:26 -0500 Received: from outbound-smtp11.blacknight.com ([46.22.139.106]:36973 "EHLO outbound-smtp11.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725980AbgK0Kx0 (ORCPT ); Fri, 27 Nov 2020 05:53:26 -0500 Received: from mail.blacknight.com (pemlinmail06.blacknight.ie [81.17.255.152]) by outbound-smtp11.blacknight.com (Postfix) with ESMTPS id 76AF01C49DE for ; Fri, 27 Nov 2020 10:53:24 +0000 (GMT) Received: (qmail 14850 invoked from network); 27 Nov 2020 10:53:24 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.22.4]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 27 Nov 2020 10:53:24 -0000 Date: Fri, 27 Nov 2020 10:53:22 +0000 From: Mel Gorman To: "Rafael J. Wysocki" Cc: Daniel Lezcano , Marcelo Tosatti , Linux Kernel Mailing List , Linux PM Subject: Re: [PATCH] cpuidle: Allow configuration of the polling interval before cpuidle enters a c-state Message-ID: <20201127105322.GO3371@techsingularity.net> References: <20201126171824.GK3371@techsingularity.net> <20201126203151.GM3371@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20201126203151.GM3371@techsingularity.net> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org On Thu, Nov 26, 2020 at 08:31:51PM +0000, Mel Gorman wrote: > > > and it is reasonable behaviour but it should be tunable. > > > > Only if there is no way to cover all of the relevant use cases in a > > generally acceptable way without adding more module params etc. > > > > In this particular case, it should be possible to determine a polling > > limit acceptable to everyone. > > > > Potentially yes. cpuidle is not my strong suit but it could try being > adaptive the polling similar to how the menu governor tries to guess > the typical interval. Basically it would have to pick a polling internal > between 2 and TICK_NSEC. Superficially it a task is queued before polling > finishes, decrease the interval and increase it otherwise. That is a mess > though because then it may be polling for ages with nothing arriving. It > would have to start tracking when the CPU exited idle to see if polling > is even worthwhile. That > > I felt that starting with anything that tried adapting the polling > interval based on heuristics would meet higher resistance than making it > tunable. Hence, make it tunable so at least the problem can be addressed > when it's encountered. > I looked at this again and determining a "polling limit acceptable to everyone" looks like reimplementing haltpoll in the core or adding haltpoll-like logic to each governor. I doubt that'll be a popular approach. The c1 exit latency as a hint is definitely too low though. I checked one of the test machines to double check what the granularity of the time checks in poll_idle() at boot time with something like this. for (i = 0; i < POLL_IDLE_RELAX_COUNT; i++) { cpu_relax(); } This takes roughly 1100ns on a test machine where the C1 exit latency is 2000ns. Lets say you have a basic pair of tasks communicating over a pipe on the same machine (e.g. perf bench pipe). The time for a round-trip on the same machine is roughly 7000ns meaning that polling is almost never useful for a basic workload. -- Mel Gorman SUSE Labs