Received: by 10.213.65.68 with SMTP id h4csp201190imn; Sat, 24 Mar 2018 18:54:44 -0700 (PDT) X-Google-Smtp-Source: AG47ELue5aq4lIlmph4CJouUTIi2W5rOY58gMiApAryOYvoeT5tK+xs7TbMSvdSvAcXsteyvEZfd X-Received: by 10.98.39.194 with SMTP id n185mr5831201pfn.30.1521942883972; Sat, 24 Mar 2018 18:54:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521942883; cv=none; d=google.com; s=arc-20160816; b=hbEBaa0u2C8ZqPwAxJfsN2iF25QeUAKAOkpBhaS1aEpDlK5rKQHEvqQh//6rLtds9y zOBKQXvqc6bPtFDzi3P8mkLVJtHmj+VdEKCPhyp05aGk7ty+++Xhoz6oecGMGfQAztfG yRAduBIuleaEHksMfP9w0O64K4HJBZ9u39a3ghFQtiKGb8WkXRAgHGPWlaYzqEvaD5g3 Hol6KhZLmKqJYkCwTlHwj1SiiF2pKpGmiUkJjGjS5+PSyW3g+kc/6Hq6y7t6UFkPop2R tLn1qoW9PGtB9Dpf8Nvun1LFxuW9YLkfogGYj8JIxWkfJKxlYzRVgtMn3RkK7Kbq4jiN IUmA== 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:arc-authentication-results; bh=lmPo07FpoTNUAG4FxCv5RAZvkGTSfqeVf7zxnsgeGzM=; b=E/R2dsXgYBbQ7x9cloatFGp1oMAt+0/idbzej5hAY00S4pc/yy/+WMD1BDR+qCmOkh vz/f/05Ih61OxFftp9gGlN1lx5nc23KJv/6Kn4z1NiOAhC0Bsk8UOJBYB32fmS53sfz6 NDX4mRrUj2XB8mgwCKuvDFABLJR1Z6hbl4WdEHhnZLfxsNl7kDIFqx3PaaikOdnpT7qU 0NKou27ax6adDuihOD8qyqZNTWJOeavChWOR46ihIoApqsGziBP3WtIXyamkvd2ZRP1F LdZMb517S9CGZsdI8NOx7CKmQsGSPXgLwG9aA4qBJDceo4iqs1dbaL7IdeQPMPt9bUUQ N7Lw== 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 97-v6si310288plc.713.2018.03.24.18.54.16; Sat, 24 Mar 2018 18:54:43 -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 S1753153AbeCYBww (ORCPT + 99 others); Sat, 24 Mar 2018 21:52:52 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:60700 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752899AbeCYBwu (ORCPT ); Sat, 24 Mar 2018 21:52:50 -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 0E89D80D; Sat, 24 Mar 2018 18:52:50 -0700 (PDT) Received: from queper01-VirtualBox (unknown [10.37.8.16]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9E3593F592; Sat, 24 Mar 2018 18:52:43 -0700 (PDT) Date: Sun, 25 Mar 2018 02:52:39 +0100 From: Quentin Perret To: Patrick Bellasi Cc: Dietmar Eggemann , linux-kernel@vger.kernel.org, Peter Zijlstra , Thara Gopinath , linux-pm@vger.kernel.org, Morten Rasmussen , Chris Redpath , Valentin Schneider , "Rafael J . Wysocki" , Greg Kroah-Hartman , Vincent Guittot , Viresh Kumar , Todd Kjos , Joel Fernandes Subject: Re: [RFC PATCH 5/6] sched/fair: Select an energy-efficient CPU on task wake-up Message-ID: <20180325015238.GB1803@queper01-VirtualBox> References: <20180320094312.24081-1-dietmar.eggemann@arm.com> <20180320094312.24081-6-dietmar.eggemann@arm.com> <20180321153518.GC13951@e110439-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180321153518.GC13951@e110439-lin> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday 21 Mar 2018 at 15:35:18 (+0000), Patrick Bellasi wrote: > On 20-Mar 09:43, Dietmar Eggemann wrote: > > From: Quentin Perret > > [...] > > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > > index 76bd46502486..65a1bead0773 100644 > > --- a/kernel/sched/fair.c > > +++ b/kernel/sched/fair.c > > @@ -6513,6 +6513,60 @@ static unsigned long compute_energy(struct task_struct *p, int dst_cpu) > > return energy; > > } > > > > +static bool task_fits(struct task_struct *p, int cpu) > > +{ > > + unsigned long next_util = cpu_util_next(cpu, p, cpu); > > + > > + return util_fits_capacity(next_util, capacity_orig_of(cpu)); > ^^^^^^^^^^^^^^^^^^^^^ > > Since here we are at scheduling CFS tasks, should we not better use > capacity_of() to account for RT/IRQ pressure ? Yes, definitely. I change this in v2. > > > +} > > + > > +static int find_energy_efficient_cpu(struct sched_domain *sd, > > + struct task_struct *p, int prev_cpu) > > +{ > > + unsigned long cur_energy, prev_energy, best_energy; > > + int cpu, best_cpu = prev_cpu; > > + > > + if (!task_util(p)) > > We are still waking up a task... what if the task was previously > running on a big CPU which is now idle? > > I understand that from a _relative_ energy_diff standpoint there is > not much to do for a 0 utilization task. However, for those tasks we > can still try to return the most energy efficient CPU among the ones > in their cpus_allowed mask. > > It should be a relatively low overhead (maybe contained in a fallback > most_energy_efficient_cpu() kind of function) which allows, for > example on ARM big.LITTLE systems, to consolidate those tasks on > LITTLE CPUs instead for example keep running them on a big CPU. Hmmmm so the difficult thing about a task with 0 util is that you don't know if this is really a small task, or a big task with a very long period. The only useful thing you know for sure about the task is where it ran last time, so I guess that makes sense to use that information rather than make assumptions. There is no perfect solution using the util_avg of the task. Now, UTIL_EST is changing the game here. If we use it for task placement (which I think is the right thing to do), this issue should be a lot easier to solve. What do you think ? Thanks, Quentin