Received: by 10.213.65.68 with SMTP id h4csp837482imn; Fri, 23 Mar 2018 18:23:34 -0700 (PDT) X-Google-Smtp-Source: AG47ELs6bVg5hzZMQVD3RdCj/MTgPr5FI1QaKHXVlpJc2bOq93x1ecfGjs89QbR9pO75RAtkXxEL X-Received: by 10.101.66.6 with SMTP id c6mr13201234pgq.35.1521854614395; Fri, 23 Mar 2018 18:23:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521854614; cv=none; d=google.com; s=arc-20160816; b=LTEuy8xkeIlW3B70SjFQE9ccQ8BBU/6WhgCpCYsQJW0Fa3KVVXLX6WpDYenBj9lmZa lgcNPowcoyezDArFWSAPFGqg+PupoIvPsPvbZMFkqJZ1upN7kzXsaqaG296wSpa80he0 vVtejRTEujem/IjMmwtt7PCGJOVxHqJgwnMfr+1DnFyMN+xEXbQdxUJmOw3sEA6dbb/S Vvd3NljCiDYnal7SGowgAvRRpauhAkXsLk6xT25X2Thrabw5cA7ArflHWhhFFUg9ez4v moHe0hXo8btv92qpAMzv8Up/e/H7m2k9FF40Odf98uLNX4FCyMThGccPPkicPiblUwYH FPHw== 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=CbuPKV5y/Gb8vaM0m4629u+ctbHyJaOdU3BKGD/Sx6Q=; b=omsl4JtNrUTmnAl3caX5Ti9uAOsAPxqfN2yXG8CouDvv+w5E1PZb/fEZUSBcZGcJsr 7bFq9gXB6lmW74/3Km92eIxa59voOFwlfCqHw+YEVZccZPxzjSFWh+fV2jyH7xo5izIY NIsqTcuz/xZfAvfGZT9c8DMUcpBcJGAJ694Oa0VNjaDf3fQr3dp+Ac/Hyr1/4hytxoim LWF9iPreAKV11pxALZEqRKvbmMJ+Vhxm6kH2MLS2IShF8rq+7dONvmaDXuPRJBhb64mO rOL7pTuvnNkial54nRMyCvr/tQUDXjA0rI98fMx9NFVVf4Wcgxli6VSohRu8zzmibU2l WkDA== 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 m185si7645516pfc.361.2018.03.23.18.23.20; Fri, 23 Mar 2018 18:23:34 -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 S1752116AbeCXBWW (ORCPT + 99 others); Fri, 23 Mar 2018 21:22:22 -0400 Received: from foss.arm.com ([217.140.101.70]:56998 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751715AbeCXBWV (ORCPT ); Fri, 23 Mar 2018 21:22:21 -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 C188080D; Fri, 23 Mar 2018 18:22:20 -0700 (PDT) Received: from queper01-VirtualBox (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 618A73F487; Fri, 23 Mar 2018 18:22:14 -0700 (PDT) Date: Sat, 24 Mar 2018 01:22:06 +0000 From: Quentin Perret To: Morten Rasmussen Cc: Joel Fernandes , Patrick Bellasi , Dietmar Eggemann , LKML , Peter Zijlstra , Thara Gopinath , Linux PM , Chris Redpath , Valentin Schneider , "Rafael J . Wysocki" , Greg Kroah-Hartman , Vincent Guittot , Viresh Kumar , Todd Kjos Subject: Re: [RFC PATCH 5/6] sched/fair: Select an energy-efficient CPU on task wake-up Message-ID: <20180324012205.GA1317@queper01-VirtualBox> References: <20180320094312.24081-1-dietmar.eggemann@arm.com> <20180320094312.24081-6-dietmar.eggemann@arm.com> <20180321153518.GC13951@e110439-lin> <20180323154745.GP4589@e105550-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180323154745.GP4589@e105550-lin.cambridge.arm.com> 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 Friday 23 Mar 2018 at 15:47:45 (+0000), Morten Rasmussen wrote: > On Thu, Mar 22, 2018 at 01:10:22PM -0700, Joel Fernandes wrote: > > On Wed, Mar 21, 2018 at 8:35 AM, Patrick Bellasi > > wrote: > > > [...] > > > > > >> @@ -6555,6 +6613,14 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f > > >> break; > > >> } > > >> > > >> + /* > > >> + * Energy-aware task placement is performed on the highest > > >> + * non-overutilized domain spanning over cpu and prev_cpu. > > >> + */ > > >> + if (want_energy && !sd_overutilized(tmp) && > > >> + cpumask_test_cpu(prev_cpu, sched_domain_span(tmp))) > > >> + energy_sd = tmp; > > >> + > > > > > > Not entirely sure, but I was trying to understand if we can avoid to > > > modify the definition of want_affine (in the previous chunk) and move > > > this block before the previous "if (want_affine..." (in mainline but > > > not in this chunk), which will became an else, e.g. > > > > > > if (want_energy && !sd_overutilized(tmp) && > > > // ... > > > else if (want_energy && !sd_overutilized(tmp) && > > > // ... > > > > > > Isn't that the same? > > > > > > Maybe there is a code path I'm missing... but otherwise it seems a > > > more self contained modification of select_task_rq_fair... > > > > Just replying to this here Patrick instead of the other thread. > > > > I think this is the right place for the block from Quentin quoted > > above because we want to search for the highest domain that is > > !overutilized and look among those for the candidates. So from that > > perspective, we can't move the block to the beginning and it seems to > > be in the right place. My main concern on the other thread was > > different, I was talking about the cases where sd_flag & tmp->flags > > don't match. In that case, sd = NULL would trump EAS and I was > > wondering if that's the right thing to do... > > You mean if SD_BALANCE_WAKE isn't set on sched_domains? > > The current code seems to rely on that flag to be set to work correctly. > Otherwise, the loop might bail out on !want_affine and we end up doing > the find_energy_efficient_cpu() on the lowest level sched_domain even if > there is higher level one which isn't over-utilized. > > However, SD_BALANCE_WAKE should be set if SD_ASYM_CPUCAPACITY is set so > sd == NULL shouldn't be possible? This only holds as long as we only > want EAS for asymmetric systems. That's correct, we are under the assumption that the SD_ASYM_CPUCAPACITY flag is set somewhere in the hierarchy here. If a sched domain has this flag set, SD_BALANCE_WAKE is propagated to all lower sched domains (see sd_init() in kernel/sched/topology.c) so we should be fine.