Received: by 10.223.164.221 with SMTP id h29csp2947410wrb; Mon, 30 Oct 2017 12:18:24 -0700 (PDT) X-Google-Smtp-Source: ABhQp+SizF6LTmVcALQhKvFH9/Cw3BTbDdn1wbVZ53tOHHYG2+xf/zzomNbteL+zSJe70ge6DPG6 X-Received: by 10.98.95.71 with SMTP id t68mr9643251pfb.348.1509391103920; Mon, 30 Oct 2017 12:18:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509391103; cv=none; d=google.com; s=arc-20160816; b=fG04zhyhjaHJGKRy7hj+xfVnodXFXR4aSQKWgM6KvoVm/DD6FB7qBJXAQus4XLJaut +L3rCCGqkVKfDmxGqU4jz7xTkX8AHNVbeeuub9Y0LfaTMMRjPYswvgRWLO5DHkoY8/Wn jRqISm1XHF5zECTqZGv+nbXSOg1ofGUHLYEdl8QOuMCLpmOLNVPtTVrsAVsC84uAyCed fGo7S1/VrtBUSrhebHnsbkBuOaGgx+Cd4v6kLNMEns03nwWmJJsI7Z6gJ+4eZi4i4BvZ KrxOuQxldg/M+g6+vAcsl6aZ856aP/LPH6ove1kqxyLwSTTY1+TCGtisLna4CjQdJe8T 9C7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=HJAvlIIbxrVYIFgk5nk26xSMPmU38DbHz4RLsw8IAU0=; b=xn/wrV/89ucdlF6Nzy1ip98rvohPet/QNAtkg63u1FifIm1/JeExMi9c8xpo6MtFUI XsbIxQYyQCTyRfiVul+DsMpVXzfRHFlROdFcUs06o+zeqk1e95fMFkd0Lmr2zLSlLAQf 8taNzwwG5Ftxpxk92ZzYPbUBPfbfzLQLxE9GlSlB1rUtodNcqiqIE+BwTIkNQWf28b9z Ox/frXqK8vEpG2NVrN9c01nYcxbrSYads7OgkX2CmBnqpecH992Q+JqR9sKQETK64mOB XgGlwS0ijaTNtBFsI1qcVTZiPxPgIC6EMhc6zZXb86V8ZSSW1RPNxpodePUsHh3YJziQ Wzlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=kErWfxAI; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 64si10030803ply.178.2017.10.30.12.18.10; Mon, 30 Oct 2017 12:18:23 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=kErWfxAI; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932724AbdJ3TDF (ORCPT + 99 others); Mon, 30 Oct 2017 15:03:05 -0400 Received: from mail-yw0-f196.google.com ([209.85.161.196]:43476 "EHLO mail-yw0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932490AbdJ3TDD (ORCPT ); Mon, 30 Oct 2017 15:03:03 -0400 Received: by mail-yw0-f196.google.com with SMTP id y75so12558374ywg.0 for ; Mon, 30 Oct 2017 12:03:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=HJAvlIIbxrVYIFgk5nk26xSMPmU38DbHz4RLsw8IAU0=; b=kErWfxAIAKvumfjHQd89/kX+uv5wSp5dZ2xG2/xkGcifqFu2inBLAJ0kFrKSuXnPzS IPOHBHSvbpaPulWQUzWyv6usafb9W3IlZHhyGrE4ho5S/rRoVBiHebETiedDefsgWbtI 8D7c3dOzWpxArgOmeQEBtJnNSItMMhaFGPuKWN3Po0zuTiZxSlvYo7RVl/YRASCigYkM 21y35cLKobgAnFXrTg0BE+LXG1LHhF1D+mPkLyT5NH8MYLY/3q5QJl9+Cig3MZxKgOhT D3C/tCtWuxFO9t+WVHxnR+7SK4fwIYUy00K6dMxXOyBho925nwm28CDh18O0IXt6vIe6 iEKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=HJAvlIIbxrVYIFgk5nk26xSMPmU38DbHz4RLsw8IAU0=; b=iMDqr7pD6+6OyR3UnR1cpqMy6TxjlTpVFEkGIrp+W6kTcM+gflJ7x7NjJt77EFtqGo fE+FhXjlTUFW+bImTqPVqN1fIkySobnQKd08Q1OLM1OsUAQ4cPQZo3YkilBMIiAozW6e nRGJYhj2dpnz3m3nLQABRO2ugugqMeIUYJFk5WbCd9Iu6hq15PYhwFzFWcVRv+G6v1P2 Vrdjeubxei/utOMO2NbVbsHUdqYhUESQMw8IVkg/YulSPxzFNLXZn0Jnw7rNiAeNZ2Xa CvMOuV3TDS474t0XPlhEE8d6WjC6wr7lsRUNPk1LNQVeUUWAfUPz5/2VmNdhRqD8bScG 3tTA== X-Gm-Message-State: AMCzsaWwqkh+GuVaZURdnWeVYDjIJmLpp3pBjD+oi0k0M7SK0ete6Yrd aWj6oAgjZpISEQyqIqT+LJFMVrBRe6OlctOSdDUSUOOBRls= X-Received: by 10.37.186.203 with SMTP id a11mr6198114ybk.460.1509390180184; Mon, 30 Oct 2017 12:03:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.224.7 with HTTP; Mon, 30 Oct 2017 12:02:59 -0700 (PDT) In-Reply-To: <20171030120709.GO4240@vireshk-i7> References: <20171028095941.4773-1-joelaf@google.com> <20171028095941.4773-3-joelaf@google.com> <20171030120709.GO4240@vireshk-i7> From: Joel Fernandes Date: Mon, 30 Oct 2017 12:02:59 -0700 Message-ID: Subject: Re: [PATCH RFC 2/5] sched/fair: Skip frequency update if CPU about to idle To: Viresh Kumar Cc: LKML , "Rafael J . Wysocki" , Ingo Molnar , Peter Zijlstra , "Cc: Srinivas Pandruvada" , "Cc: Len Brown" , "Cc: Juri Lelli" , "Cc: Patrick Bellasi" , "Cc: Steve Muckle" , "Cc: Brendan Jackman" , "Cc: Chris Redpath" , "Cc: Atish Patra" , "Cc: Dietmar Eggemann" , "Cc: Vincent Guittot" , "Cc: Morten Ramussen" , "Cc: Frederic Weisbecker" , "Cc: Thomas Gleixner" , "Cc: EAS Dev" , "Cc: Android Kernel" , Steven Rostedt Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Viresh, On Mon, Oct 30, 2017 at 5:07 AM, Viresh Kumar wrote: > On 28-10-17, 02:59, Joel Fernandes wrote: >> Updating CPU frequency on last dequeue of a CPU is useless. Because the >> utilization since CPU came out of idle can increase till the last dequeue, this >> means we are requesting for a higher frequency before entering idle which is >> not very meaningful or useful. It causes unwanted wakeups of the schedutil >> governor kthread in slow-switch systems resulting in large number of wake ups >> that could have been avoided. In an Android application playing music where the >> music app's thread wakes up and sleeps periodically on an Android device, its >> seen that the frequency increases slightly on the dequeue and is reduced when >> the task wakes up again. This oscillation continues between 300Mhz and 350Mhz, >> and while the task is running, its at 300MHz the whole time. This is pointless. >> Adding to that, these are unnecessary wake ups. Infact most of the time when >> the sugov thread wakes up, all the CPUs are idle - so it can hurt power by >> disturbing the cluster when it is idling. >> >> This patch prevents a frequency update on the last dequeue. With this the >> number of schedutil governor thread wake ups are reduces more than 2 times >> (1389 -> 527). >> >> Cc: Rafael J. Wysocki >> Cc: Viresh Kumar >> Cc: Ingo Molnar >> Cc: Peter Zijlstra >> Signed-off-by: Joel Fernandes >> --- >> kernel/sched/fair.c | 25 ++++++++++++++++++++++--- >> kernel/sched/sched.h | 1 + >> 2 files changed, 23 insertions(+), 3 deletions(-) > > So you are doing this only for CFS, isn't that required for RT/DL as > well? Yes I agree we should. I remember this patch from Patrick doing something similar for RT: https://patchwork.kernel.org/patch/9825461/ That patch prevents cpufreq update from dequeue_task_rt path since we no longer would trigger it from update_curr_rt all the time. Is this an acceptable solution for RT? > > Also, this more looks like a policy decision. Will it be better to > put that directly into schedutil? Like this: > > if (cpu_idle()) > "Don't change the freq"; > > Will something like that work? I thought about this and I think it wont work very well. In the dequeue path we're still running the task being dequeued so the CPU is not yet idle. What is needed here IMO is a notion that the CPU is possibly about to idle and we can get predict that from the dequeue path of the CFS class. Also just looking at whether the CPU is currently idle or not in the governor doesn't help to differentiate between say the dequeue path / tick path. Both of which can occur when the CPU is not idle. Any thoughts about this? thanks, - Joel From 1582684234846900858@xxx Mon Oct 30 12:08:25 +0000 2017 X-GM-THRID: 1582495113361800894 X-Gmail-Labels: Inbox,Category Forums