Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp5239467ybx; Sun, 10 Nov 2019 09:25:11 -0800 (PST) X-Google-Smtp-Source: APXvYqzXCEpRJEpMY+nAdA0vXKJetnNZwRrBjhu4j/G3ZciZmb9WCZj26F5NCkpBoV2iNRcLUKBR X-Received: by 2002:a50:fb8d:: with SMTP id e13mr21460126edq.213.1573406711568; Sun, 10 Nov 2019 09:25:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573406711; cv=none; d=google.com; s=arc-20160816; b=BL4Q4BikfLn38jCDTynosO8frZfC9g0IM9XmdJ3MLbT9MjqwVr+0yf2BJEyU9rzsfz B1P2RZxmc9yexjNAqm1jOuy1TzyVV1fXLX3Hylm9mO6xaM/ocAMLBXS6uoN0OuJMpuVT IXe5SnZSpbFWK95HcnKn3yufMCkjtBNA0K2tTZ3QJ28RQ6q6UXZe76VIW4aUlbAL3vOr lXJyV34aG9Uf8uvZM6EVSR7Ia9oE+1PTWjg5SqLuQT0Tq54LTFZNFCQMsdDDYSMfCcqU zfVNjHTJex/WQdqvV6PwEgVwfgKNoBS2LlblKsNZwkwsk4W7YHn1Gk4FrD+p8hnXpYAI P93g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=dd0y70jJ3Pw1geA7keAfU6HA18CcneyOSAqi5EKeCdA=; b=AlMS34tAgl5i442TDIPjHWD2+YfZBYGvtBzbUAHqHxQdQ4zrp5Z4tr0LEu3NS61dj1 DMqvoj/jO06i35BAGtoH1bUMBl9som7AuxbftYJgFf0bvrRQPlyeGhoiKhBXisM5tu0J Z0OOgfbP+rBc1ahrw96MHChqqtquJlb45esqZ0EFLHHobTyK8vKxCr9FUH2Hcw3l4ZK1 P6n+0nzyR3+nw1QCUj+V9h5K4ZcHEXlvHkLfNym2jaBpdJUF5jxpKy2g7YLRq8Nmm1Hj cJoaE9oAibfm8d7w3y4wLyjOtrJeXsWIfLnoze8TivSxDm+b604I5hB4jkqUtGqHygND GF3A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gx24si8050180ejb.429.2019.11.10.09.24.48; Sun, 10 Nov 2019 09:25:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727034AbfKJRYH (ORCPT + 99 others); Sun, 10 Nov 2019 12:24:07 -0500 Received: from cloudserver094114.home.pl ([79.96.170.134]:53730 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726710AbfKJRYG (ORCPT ); Sun, 10 Nov 2019 12:24:06 -0500 Received: from 79.184.254.83.ipv4.supernova.orange.pl (79.184.254.83) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.292) id 28f6aa7359404610; Sun, 10 Nov 2019 18:24:04 +0100 From: "Rafael J. Wysocki" To: Doug Smythies Cc: Peter Zijlstra , Daniel Lezcano , LKML , Giovanni Gherdovich , Linux PM Subject: Re: [PATCH v2] cpuidle: Use nanoseconds as the unit of time Date: Sun, 10 Nov 2019 18:24:04 +0100 Message-ID: <6163696.37NBKbymtj@kreacher> In-Reply-To: References: <10494959.bKODIZ00nm@kreacher> <000a01d59656$99798710$cc6c9530$@net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sunday, November 10, 2019 5:48:21 PM CET Rafael J. Wysocki wrote: > On Fri, Nov 8, 2019 at 6:04 PM Doug Smythies wrote: > > > > On 2019.11.08 01:45 Rafael J. Wysocki wrote: > > > On Fri, Nov 8, 2019 at 9:45 AM Doug Smythies wrote: > > > > > ... > > >> I have been running this v2 today, with both menu and teo > > >> governors. Acquiring some baseline reference data to compare > > >> to now. The menu governor response seems different (Supporting > > >> information/graphs will come later). > > > > > > That may be good or bad, depending in what way it is different. :-) > > > > My thinking was that the differences should be minimal between > > the baseline (linux-next as of 2019.11.07) and plus your two patches. > > Because this was a change of units, but not functionality. > > Such is the case with the teo governor, but not the menu governor. > > I have not tried the ladder or haltpoll governors, and don't intend to. > > > > Now to attempt to isolate the issue in the code, which might take > > considerable time. > > Thanks! > > It looks like I have overlooked a unit conversion in menu or done a > unit conversion twice somewhere. I have found a bug, which should be addressed by the patch below. If it still doesn't reduce the discrepancy, we'll need to look further. --- drivers/cpuidle/governors/menu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Index: linux-pm/drivers/cpuidle/governors/menu.c =================================================================== --- linux-pm.orig/drivers/cpuidle/governors/menu.c +++ linux-pm/drivers/cpuidle/governors/menu.c @@ -516,8 +516,8 @@ static void menu_update(struct cpuidle_d new_factor -= new_factor / DECAY; if (data->next_timer_ns > 0 && measured_ns < MAX_INTERESTING) - new_factor += RESOLUTION * div64_u64(measured_ns, - data->next_timer_ns); + new_factor += div64_u64(RESOLUTION * measured_ns, + data->next_timer_ns); else /* * we were idle so long that we count it as a perfect