Received: by 10.192.165.148 with SMTP id m20csp5084871imm; Tue, 8 May 2018 21:57:47 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq/623mKljmqgbznuXgUtrQRxA/wZE3QZNf246EEPXalxd2wl+TU5UVm5v7RDGH4Bw1aPxs X-Received: by 2002:a17:902:5c6:: with SMTP id f64-v6mr43806821plf.77.1525841867022; Tue, 08 May 2018 21:57:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525841866; cv=none; d=google.com; s=arc-20160816; b=aLBFVxZH6dZnYzHdtqhhyt5YNubl4x4qjVDW9Jn3hxZJYFe0XWWubWnsw62d8NMtTg qlvezmxaeX83/73cuDFauTxqCKWM1f8F8T1DIneWX/sw/TNjzi4T9EtSwFW7o5pQG9ut Er2i61yOmpC2XmL8EluImG0MwSJLklfYIJvJ4JYwLMUgY1JdB6q6M/pwqwwuhq0v2+AB WsoZsHoghnxLNy6enmAmREyyionwO0Rq2C80ZYEvOakdTPOl2mOG2ndH7SItlMVpNNq4 4/LAiTNp4jEVpKmYbG7cJcU67pTueL3eK/qROdVnkl9PKDS8JM2azbq15h2Da8HP9Xmk QErA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=B29eWdBoQ5VIhBXGA0DSDv9sn6zgBApmWE1isQzhQnM=; b=zalteMCYqUCtp5NNKsN91Y/GLXp/tcFExBH7j1KVA3yg7nRwq7aZzyDSkBNL/NCfQf K8guaXtyo4yJiE+plR+UIrgcZexEXgpMEnGm1nGTbGuJQTurTOkuFf/wP48pBLq2nmnw Zwpfc9pZq4LtkMSidicsONJc62P5LxKWRRS3kY1zBTGBb3KYHowAd/uX49ziM91+LUmM mtgnICOcFkxekiFDXxMZagLoz6eMxlgABARAn4BdmC9Bve6PkcFQPlgJXqmw9xFK2PHK CWpWOnr7rr9lVtA+KaHk8UkOcr4X35sQbdTUorEivKKsYk8O640F3SFBQG69eD3L9Okd oQMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TwTFQZUA; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q9-v6si20243131pgt.5.2018.05.08.21.57.32; Tue, 08 May 2018 21:57:46 -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=@linaro.org header.s=google header.b=TwTFQZUA; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753306AbeEIEzb (ORCPT + 99 others); Wed, 9 May 2018 00:55:31 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:43049 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751922AbeEIEz3 (ORCPT ); Wed, 9 May 2018 00:55:29 -0400 Received: by mail-pg0-f65.google.com with SMTP id k11-v6so21004557pgo.10 for ; Tue, 08 May 2018 21:55:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=B29eWdBoQ5VIhBXGA0DSDv9sn6zgBApmWE1isQzhQnM=; b=TwTFQZUA+KXqWebtDJznARLrXW2yZSlTJknXM462JqUANpZu1Y9hgMk6j1dBo2vyeP oSnUxgITSCKXIXuy5q7qE3j5gqocaV2B9+HtCSLO+pOz06wT3535DfDHvjBqR/w36Meh TLuyt+w1gfwiMKNNsQa6nyEaMCfzLeWsJoLMA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=B29eWdBoQ5VIhBXGA0DSDv9sn6zgBApmWE1isQzhQnM=; b=N4YtLrPr8X5exOV6p5wGYBeVl1DCYkPvgQxK8ay5LcBRp3HQgcAKvOsoFLSBAmRzb+ ywQ1F42c2IDnLFxBv4mV/TRXVGDFuubuTwyCZTC5TTBPIuetUrDuND69ntk+NLlMB0hC QYX+iiUt+uNH6hhDDyhhkuZC80uEnWFMTY1rQOBRNQKdq/zD1suaYHJwo6qk/sTPtUDb Wx7KLFwBC5McTFBhUHt5UeIc4De78J/HrqW3M/g/vPccxZZNFZ/Ew6HXKiXBbssFcsm8 nBlnGI3vZFBsYhMiz+AFzrPc3qgJuNX8WPt8RsMMT0RzbmO/YSjGJ2kLkI2mKEfUgS2z 1F0w== X-Gm-Message-State: ALQs6tASVNEgXCR7lcR/R2NAFCMstRE6vHeJ3XmfZHCpDpsERAowMw9W qeLf+01XJIENXVaZQYI441HcRA== X-Received: by 2002:a63:2787:: with SMTP id n129-v6mr34798502pgn.167.1525841729395; Tue, 08 May 2018 21:55:29 -0700 (PDT) Received: from localhost ([122.167.163.112]) by smtp.gmail.com with ESMTPSA id n5sm35964578pff.134.2018.05.08.21.55.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 21:55:28 -0700 (PDT) Date: Wed, 9 May 2018 10:25:27 +0530 From: Viresh Kumar To: Dietmar Eggemann Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar , linux-pm@vger.kernel.org, Pavan Kondeti , "Rafael J . Wysocki" , Juri Lelli , Joel Fernandes , Patrick Bellasi , Quentin Perret Subject: Re: [PATCH] Revert "cpufreq: schedutil: Don't restrict kthread to related_cpus unnecessarily" Message-ID: <20180509045527.ylf2nwolsxxcsjkq@vireshk-i7> References: <20180508073340.13114-1-dietmar.eggemann@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180508073340.13114-1-dietmar.eggemann@arm.com> User-Agent: NeoMutt/20180323-120-3dd1ac Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08-05-18, 08:33, Dietmar Eggemann wrote: > This reverts commit e2cabe48c20efb174ce0c01190f8b9c5f3ea1d13. > > Lifting the restriction that the sugov kthread is bound to the > policy->related_cpus for a system with a slow switching cpufreq driver, > which is able to perform DVFS from any cpu (e.g. cpufreq-dt), is not > only not beneficial it also harms Enery-Aware Scheduling (EAS) on > systems with asymmetric cpu capacities (e.g. Arm big.LITTLE). > > The sugov kthread which does the update for the little cpus could > potentially run on a big cpu. It could prevent that the big cluster goes > into deeper idle states although all the tasks are running on the little > cluster. > > Example: hikey960 w/ 4.16.0-rc6-+ > Arm big.LITTLE with per-cluster DVFS > > root@h960:~# cat /proc/cpuinfo | grep "^CPU part" > CPU part : 0xd03 (Cortex-A53, little cpu) > CPU part : 0xd03 > CPU part : 0xd03 > CPU part : 0xd03 > CPU part : 0xd09 (Cortex-A73, big cpu) > CPU part : 0xd09 > CPU part : 0xd09 > CPU part : 0xd09 > > root@h960:/sys/devices/system/cpu/cpufreq# ls > policy0 policy4 schedutil > > root@h960:/sys/devices/system/cpu/cpufreq# cat policy*/related_cpus > 0 1 2 3 > 4 5 6 7 > > (1) w/o the revert: > > root@h960:~# ps -eo pid,class,rtprio,pri,psr,comm | awk 'NR == 1 || > /sugov/' > PID CLS RTPRIO PRI PSR COMMAND > 1489 #6 0 140 1 sugov:0 > 1490 #6 0 140 0 sugov:4 > > The sugov kthread sugov:4 responsible for policy4 runs on cpu0. (In this > case both sugov kthreads run on little cpus). > > cross policy (cluster) remote callback example: > ... > migration/1-14 [001] enqueue_task_fair: this_cpu=1 cpu_of(rq)=5 > migration/1-14 [001] sugov_update_shared: this_cpu=1 sg_cpu->cpu=5 > sg_cpu->sg_policy->policy->related_cpus=4-7 > sugov:4-1490 [000] sugov_work: this_cpu=0 > sg_cpu->sg_policy->policy->related_cpus=4-7 > ... > > The remote callback (this_cpu=1, target_cpu=5) is executed on cpu=0. > > (2) w/ the revert: > > root@h960:~# ps -eo pid,class,rtprio,pri,psr,comm | awk 'NR == 1 || > /sugov/' > PID CLS RTPRIO PRI PSR COMMAND > 1491 #6 0 140 2 sugov:0 > 1492 #6 0 140 4 sugov:4 > > The sugov kthread sugov:4 responsible for policy4 runs on cpu4. > > cross policy (cluster) remote callback example: > ... > migration/1-14 [001] enqueue_task_fair: this_cpu=1 cpu_of(rq)=7 > migration/1-14 [001] sugov_update_shared: this_cpu=1 sg_cpu->cpu=7 > sg_cpu->sg_policy->policy->related_cpus=4-7 > sugov:4-1492 [004] sugov_work: this_cpu=4 > sg_cpu->sg_policy->policy->related_cpus=4-7 > ... > > The remote callback (this_cpu=1, target_cpu=7) is executed on cpu=4. > > Now the sugov kthread executes again on the policy (cluster) for which > the Operating Performance Point (OPP) should be changed. > It avoids the problem that an otherwise idle policy (cluster) is running > schedutil (the sugov kthread) for another one. > > Cc: Viresh Kumar > Cc: Rafael J. Wysocki > Cc: Peter Zijlstra > Cc: Ingo Molnar > Cc: Pavan Kondeti > Cc: Juri Lelli > Cc: Joel Fernandes > Cc: Patrick Bellasi > Cc: Quentin Perret > Signed-off-by: Dietmar Eggemann > --- > kernel/sched/cpufreq_schedutil.c | 6 +----- > 1 file changed, 1 insertion(+), 5 deletions(-) > > diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c > index d2c6083304b4..63014cff76a5 100644 > --- a/kernel/sched/cpufreq_schedutil.c > +++ b/kernel/sched/cpufreq_schedutil.c > @@ -523,11 +523,7 @@ static int sugov_kthread_create(struct sugov_policy *sg_policy) > } > > sg_policy->thread = thread; > - > - /* Kthread is bound to all CPUs by default */ > - if (!policy->dvfs_possible_from_any_cpu) > - kthread_bind_mask(thread, policy->related_cpus); > - > + kthread_bind_mask(thread, policy->related_cpus); > init_irq_work(&sg_policy->irq_work, sugov_irq_work); > mutex_init(&sg_policy->work_lock); > Acked-by: Viresh Kumar -- viresh