Received: by 10.223.164.221 with SMTP id h29csp1382388wrb; Fri, 13 Oct 2017 18:24:40 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDSRFcT0hdtKkzyD7h/fkWSfNHJTNF8YY7OfQayUo0Z8kmUpkjOU3bLkVm2zgcNHNZLsiM6 X-Received: by 10.84.129.229 with SMTP id b92mr2967784plb.362.1507944280041; Fri, 13 Oct 2017 18:24:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507944280; cv=none; d=google.com; s=arc-20160816; b=dXowzF5OVnBz9lgm0SCSISkQfNmmz/U8CeMqGuY0I9o2ZE2lqbYQcmnVBGnIt5SS3C m21OtA+FWAt/ILIBFx/wYhlQcg5rkrV/T1A9o4qBRZFjFExunjTj94hgREbMAVeARaXZ kDOrdSpuKgWRJ0DZPkEMGfwOsGjACuZNwR+Rw+gtLNLdKg91WYTqpt6pjV9qzsmrioVm Oe+ukB8dVqG9KFySrtMvp6EC1FKqdcbBTMjhb+c1F17HdzlkyRObFWonCxTcNxjQgIfK T1YjCitDXK6/ZUwctCa3v85IJ64+MnGwSuv8x/58A9We3kbMFuV5W9yxBDkUlfd63Ikn HOyg== 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 :arc-authentication-results; bh=en97QM2ulssxPWSUeIcPEEs9o5bOqW7KRfJuLVRu/K8=; b=xrJKI/XLSki5NwgI67RcF+/lmeKQnypLvVZYKfUPWKHAIoSSgH67IRxF+urQvjJVAi sxxIRLVrFu1XLuEq5CV9WrRqnvx5N/UBun+WtLBJ28uZnIidlpLaSWiV3x3rS9xwfrYD 0mB3tp2CYkm8T8s0G7sGyBX5e9Ww7xm6TVUz6672O5Xo7cqmTIYPajuZajtxrD9g/LDt pWHBHqg37R0SF4NPoqeb5h01sYCnUNxuHPoGWjmCy6E9At3PpQPyZgqewK/XZKdCP//p JhGnpU4JWYl5kEGAOlL5nc/CZH/Hng2wfw0EfDVO7XvoVhjEXtOWOVnG4yOu8AEJNCGh 755w== 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 h3si1293569pll.816.2017.10.13.18.24.15; Fri, 13 Oct 2017 18:24:40 -0700 (PDT) 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 S1753261AbdJNBXo (ORCPT + 99 others); Fri, 13 Oct 2017 21:23:44 -0400 Received: from cloudserver094114.home.net.pl ([79.96.170.134]:54807 "EHLO cloudserver094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751617AbdJNBXn (ORCPT ); Fri, 13 Oct 2017 21:23:43 -0400 Received: from 79.184.255.244.ipv4.supernova.orange.pl (79.184.255.244) (HELO aspire.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.82) id 73e89b53d9301a38; Sat, 14 Oct 2017 03:23:41 +0200 From: "Rafael J. Wysocki" To: Aubrey Li Cc: tglx@linutronix.de, peterz@infradead.org, len.brown@intel.com, ak@linux.intel.com, tim.c.chen@linux.intel.com, x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v2 0/8] Introduct cpu idle prediction functionality Date: Sat, 14 Oct 2017 03:14:10 +0200 Message-ID: <3026355.QRuoy6eIZM@aspire.rjw.lan> In-Reply-To: <1506756034-6340-1-git-send-email-aubrey.li@intel.com> References: <1506756034-6340-1-git-send-email-aubrey.li@intel.com> 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 Saturday, September 30, 2017 9:20:26 AM CEST Aubrey Li wrote: > We found under some latency intensive workloads, short idle periods occurs > very common, then idle entry and exit path starts to dominate, so it's > important to optimize them. To determine the short idle pattern, we need > to figure out how long of the coming idle and the threshold of the short > idle interval. > > A cpu idle prediction functionality is introduced in this proposal to catch > the short idle pattern. > > Firstly, we check the IRQ timings subsystem, if there is an event > coming soon. > -- https://lwn.net/Articles/691297/ > > Secondly, we check the idle statistics of scheduler, if it's likely we'll > go into a short idle. > -- https://patchwork.kernel.org/patch/2839221/ > > Thirdly, we predict the next idle interval by using the prediction > fucntionality in the idle governor if it has. > > For the threshold of the short idle interval, we record the timestamps of > the idle entry, and multiply by a tunable parameter at here: > -- /proc/sys/kernel/fast_idle_ratio > > We use the output of the idle prediction to skip turning tick off if a > short idle is determined in this proposal. Reprogramming hardware timer > twice(off and on) is expensive for a very short idle. There are some > potential optimizations can be done according to the same indicator. > > I observed when system is idle, the idle predictor reports 20/s long idle > and ZERO fast idle on one CPU. And when the workload is running, the idle > predictor reports 72899/s fast idle and ZERO long idle on the same CPU. > > Aubrey Li (8): > cpuidle: menu: extract prediction functionality > cpuidle: record the overhead of idle entry > cpuidle: add a new predict interface > tick/nohz: keep tick on for a fast idle > timers: keep sleep length updated as needed > cpuidle: make fast idle threshold tunable > cpuidle: introduce irq timing to make idle prediction > cpuidle: introduce run queue average idle to make idle prediction > > drivers/cpuidle/Kconfig | 1 + > drivers/cpuidle/cpuidle.c | 109 +++++++++++++++++++++++++++++++++++++++ > drivers/cpuidle/governors/menu.c | 69 ++++++++++++++++--------- > include/linux/cpuidle.h | 21 ++++++++ > kernel/sched/idle.c | 14 ++++- > kernel/sysctl.c | 12 +++++ > kernel/time/tick-sched.c | 7 +++ > 7 files changed, 209 insertions(+), 24 deletions(-) > Overall, it looks like you could avoid stopping the tick every time the predicted idle duration is not longer than the tick interval in the first place. Why don't you do that? From 1579948553110255952@xxx Sat Sep 30 07:25:56 +0000 2017 X-GM-THRID: 1579948553110255952 X-Gmail-Labels: Inbox,Category Forums