Received: by 10.223.164.202 with SMTP id h10csp58846wrb; Wed, 29 Nov 2017 17:01:31 -0800 (PST) X-Google-Smtp-Source: AGs4zMaYqQlRE8YFN23qVvZM4O/hxJiTyg9VLYK/AlGefQ5kPKBL9xbiSrj5a1/RMNaNvg2g9EdQ X-Received: by 10.101.81.202 with SMTP id i10mr719974pgq.23.1512003691068; Wed, 29 Nov 2017 17:01:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512003691; cv=none; d=google.com; s=arc-20160816; b=Sn4PHJuCbslsnvKF/PBwv/hxgcUt2nBHIek83qSvdWIw6UxJyzDwGHL7hDlUKMEwWo KUUlOTIHQBG3Q8V7QgKINSVWUeM4U4fTsPQGglBPGAj4TEqhA35Yq20egiyqtqtnM4e2 LN77J67zzRj5XnU27XxuewxGAkuTnVesqj698FngIemGKKUFrxnjhZ8RPjQ2yTn4yxm1 WVx8FD+9LpzGdrQPWR6G6FuoRQ5wvwAjlFModpsJcXeAyd3/RZCGSLoi11mohyxIQmmq dQFc5Aa0eUdaffd2pjU1IadQ0qIvTRgv6922O2rPRDmeFGNIk+dKGiY9VDwq4MNuwIhs SyPA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=GUK8kfk/fYPiA5qu430zz6XWcJuxhxlccG2ajhzLuG8=; b=abwY8P8b+WIq5W1sq0xR3EtadE/pZ9WJrLG9wZLD5xkPoqCZ0fcUuxI9ktOt+RyWd1 Np8HqhEcdlcZEIV/vsnnCJwFS9wbG8bLgLLObxe8ePQS8LJmk1zzRUQ2ta9VUrUz54fY bGBJuRX2TW03K3x/wNtYRuyGa15T1JqJ8TAogTHIzrLpLQv9LEG4UoA/xdarK18+HynL 6sKlDaN6CuOErQsYlpr1rgGXjMgeKeAc8uF5PHB8DrqbzI+RBMHvsNF7u+IlOZVCWw9X Na/7VgP4cE13o2qJZlViErbt9KKMgAcEkApQb7HMKzccLNff5TRRSAFXGFHsNtE1Vqoj /G4g== 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 s18si2259795pfd.67.2017.11.29.17.01.16; Wed, 29 Nov 2017 17:01:31 -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 S1753144AbdK3BBB (ORCPT + 99 others); Wed, 29 Nov 2017 20:01:01 -0500 Received: from mga05.intel.com ([192.55.52.43]:5172 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752682AbdK3BBA (ORCPT ); Wed, 29 Nov 2017 20:01:00 -0500 Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Nov 2017 17:01:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,339,1508828400"; d="scan'208";a="182186676" Received: from cli6-desk1.ccr.corp.intel.com (HELO [10.239.13.116]) ([10.239.13.116]) by fmsmga006.fm.intel.com with ESMTP; 29 Nov 2017 17:00:58 -0800 Subject: Re: [RFC PATCH v2 0/8] Introduct cpu idle prediction functionality To: Aubrey Li , tglx@linutronix.de, peterz@infradead.org, rjw@rjwysocki.net, len.brown@intel.com, ak@linux.intel.com, tim.c.chen@linux.intel.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org References: <1506756034-6340-1-git-send-email-aubrey.li@intel.com> From: "Li, Aubrey" Message-ID: <0f4d78d4-09d7-5b68-8706-5427b39fa0ed@linux.intel.com> Date: Thu, 30 Nov 2017 09:00:58 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <1506756034-6340-1-git-send-email-aubrey.li@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Thanks Rafael's comments against V2. I'd like to ping here to see which direction this proposal should go and what fundamental change this proposal should make. I'm also open to any suggestions if my proposal is not on the right way. Thanks, -Aubrey On 2017/9/30 15:20, 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(-) > From 1581517559705971419@xxx Tue Oct 17 15:04:37 +0000 2017 X-GM-THRID: 1579948553110255952 X-Gmail-Labels: Inbox,Category Forums