From patchwork Thu May 14 14:03:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dietmar Eggemann X-Patchwork-Id: 6405911 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 163DBC0432 for ; Thu, 14 May 2015 14:03:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6D1302034F for ; Thu, 14 May 2015 14:03:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8FB4D2026D for ; Thu, 14 May 2015 14:03:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965039AbbENODf (ORCPT ); Thu, 14 May 2015 10:03:35 -0400 Received: from eu-smtp-delivery-143.mimecast.com ([207.82.80.143]:31235 "EHLO eu-smtp-delivery-143.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965035AbbENODc convert rfc822-to-8bit (ORCPT ); Thu, 14 May 2015 10:03:32 -0400 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by uk-mta-26.uk.mimecast.lan; Thu, 14 May 2015 15:03:29 +0100 Received: from [10.2.131.51] ([10.1.2.79]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 14 May 2015 15:03:27 +0100 Message-ID: <5554AB41.8070602@arm.com> Date: Thu, 14 May 2015 15:03:45 +0100 From: Dietmar Eggemann User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Morten Rasmussen , "peterz@infradead.org" , "mingo@redhat.com" CC: "vincent.guittot@linaro.org" , "yuyang.du@intel.com" , "preeti@linux.vnet.ibm.com" , "mturquette@linaro.org" , "rjw@rjwysocki.net" , Juri Lelli , "sgurrappadi@nvidia.com" , "pang.xunlei@zte.com.cn" , "linux-kernel@vger.kernel.org" , "linux-pm@vger.kernel.org" Subject: Re: [RFCv4 PATCH 31/34] sched: Energy-aware wake-up task placement References: <1431459549-18343-1-git-send-email-morten.rasmussen@arm.com> <1431459549-18343-32-git-send-email-morten.rasmussen@arm.com> In-Reply-To: <1431459549-18343-32-git-send-email-morten.rasmussen@arm.com> X-OriginalArrivalTime: 14 May 2015 14:03:27.0938 (UTC) FILETIME=[C058C220:01D08E4E] X-MC-Unique: aWkVIbAWRJKeKMmBv6wlmg-1 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 12/05/15 20:39, Morten Rasmussen wrote: > Let available compute capacity and estimated energy impact select > wake-up target cpu when energy-aware scheduling is enabled and the > system in not over-utilized (above the tipping point). > > energy_aware_wake_cpu() attempts to find group of cpus with sufficient > compute capacity to accommodate the task and find a cpu with enough spare > capacity to handle the task within that group. Preference is given to > cpus with enough spare capacity at the current OPP. Finally, the energy > impact of the new target and the previous task cpu is compared to select > the wake-up target cpu. > > cc: Ingo Molnar > cc: Peter Zijlstra > > Signed-off-by: Morten Rasmussen [...] > /* > * select_task_rq_fair: Select target runqueue for the waking task in domains > * that have the 'sd_flag' flag set. In practice, this is SD_BALANCE_WAKE, > @@ -5446,7 +5526,10 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f > prev_cpu = cpu; > > if (sd_flag & SD_BALANCE_WAKE && want_sibling) { > - new_cpu = select_idle_sibling(p, prev_cpu); > + if (energy_aware() && !cpu_rq(cpu)->rd->overutilized) > + new_cpu = energy_aware_wake_cpu(p); If you run RFCv4 on an X86 system w/o energy model, you get a 'BUG: unable to handle kernel paging request at ...' problem after you've enabled energy awareness (echo ENERGY_AWARE > /sys/kernel/debug/sched_features). This is related to the fact that cpumask functions like cpumask_test_cpu (e.g. later in select_task_rq) can't deal with cpu set to -1. If you enable CONFIG_DEBUG_PER_CPU_MAPS you get the following warning in this case: WARNING: CPU: 0 PID: 0 at include/linux/cpumask.h:117 cpumask_check.part.79+0x1f/0x30() We also get the warning on ARM (w/o energy model) but my TC2 system is not crashing like the X86 box. Shouldn't we return prev_cpu in case sd_ea is NULL just as select_idle_sibling does if prev_cpu is idle? > + else > + new_cpu = select_idle_sibling(p, prev_cpu); > goto unlock; > } --- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index f5897a021f23..8a014fdd6e76 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5394,7 +5394,7 @@ static int select_idle_sibling(struct task_struct *p, int target) return target; } -static int energy_aware_wake_cpu(struct task_struct *p) +static int energy_aware_wake_cpu(struct task_struct *p, int target) { struct sched_domain *sd; struct sched_group *sg, *sg_target; @@ -5405,7 +5405,7 @@ static int energy_aware_wake_cpu(struct task_struct *p) sd = rcu_dereference(per_cpu(sd_ea, task_cpu(p))); if (!sd) - return -1; + return target; sg = sd->groups; sg_target = sg; @@ -5527,7 +5527,7 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f if (sd_flag & SD_BALANCE_WAKE && want_sibling) { if (energy_aware() && !cpu_rq(cpu)->rd->overutilized) - new_cpu = energy_aware_wake_cpu(p); + new_cpu = energy_aware_wake_cpu(p, prev_cpu); else new_cpu = select_idle_sibling(p, prev_cpu); goto unlock;