Received: by 10.192.165.148 with SMTP id m20csp3987808imm; Tue, 8 May 2018 00:34:18 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpHMkrpWWJ4D2Ipx/O52c+g5lVO+t+VQyn3aODfinTCPHGbBbShPIPUMUH2ZxNFq8PZD5mg X-Received: by 2002:a65:560f:: with SMTP id l15-v6mr1242921pgs.186.1525764858553; Tue, 08 May 2018 00:34:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525764858; cv=none; d=google.com; s=arc-20160816; b=jdc1suvKnhLhnaPiOZ93RbK/vDO5yJEonnE8od+GLJLJvuXKUlgNYzv0AyuBOZ68qH nlCTXAJeTmq06GRp2CFj5MEKOM7HNChMEInuXs/Eh/jywoOgISZxe5tjwblax012XSBr DwH89BOuD9+gGUGAdxOjn4EmpTnedr83l6po+sZgGjATtg9MIPd05VJPpCjJqDxmUrvZ Cd89fUGAuo7qyKBItJn2rKYNivw1KQ2uvDQYDWMKJWU/jLVbTDCr0b/ewMPg4Kmm+UlE z3fMkPWOXisxCz+v+Feh5UBL+0nM13/s5RQOoLuBQPRYr9VSZXN0cqV13IZq7CplUr0y osow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=2Ioc0teAV8T+Zs5IlD58zeiNSZtppmAKdycSGRif3to=; b=Ye9kj20xcs8yTM7OyknrGaUlNSpA8xwM15RiJVfH0wewk+vyQTXeuZssICLSDMfjb0 18vWgGE9aYpO+dQcn8jx+54fDS46ikAWr51zJBBzAnmaU0/gHCTjDOeMo6OGFgg0quGs /ekv9RVYGXDGGVhNR+QKQAGRutAcAFOwvD13og82BF8B8dNmytxotqlaAmItvzAZOhDH qGBUBk4aySq2V5tpy+IvIgxIcOQ2S2fdkko8+wArjvcFQRMjtCz3FML/h1IMFWDuJ7ea Z3TmN5cvrmcJRq3HTwbSAw2YjmqfQxg51x5+f5mdzQwesJMX6slkAyNzcru+cE0KIu8Q +GLg== 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 f9-v6si19083661pge.639.2018.05.08.00.34.04; Tue, 08 May 2018 00:34:18 -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 S1754731AbeEHHdy (ORCPT + 99 others); Tue, 8 May 2018 03:33:54 -0400 Received: from foss.arm.com ([217.140.101.70]:53624 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754492AbeEHHdw (ORCPT ); Tue, 8 May 2018 03:33:52 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 14C1B1529; Tue, 8 May 2018 00:33:52 -0700 (PDT) Received: from e107985-lin.cambridge.arm.com (e107985-lin.cambridge.arm.com [10.1.210.41]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 25F373F592; Tue, 8 May 2018 00:33:50 -0700 (PDT) From: Dietmar Eggemann To: linux-kernel@vger.kernel.org, Viresh Kumar , Peter Zijlstra , Ingo Molnar Cc: linux-pm@vger.kernel.org, Pavan Kondeti , "Rafael J . Wysocki" , Juri Lelli , Joel Fernandes , Patrick Bellasi , Quentin Perret Subject: [PATCH] Revert "cpufreq: schedutil: Don't restrict kthread to related_cpus unnecessarily" Date: Tue, 8 May 2018 08:33:40 +0100 Message-Id: <20180508073340.13114-1-dietmar.eggemann@arm.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); -- 2.11.0