Received: by 10.213.65.68 with SMTP id h4csp833526imn; Fri, 23 Mar 2018 18:15:07 -0700 (PDT) X-Google-Smtp-Source: AG47ELtdHKJJr1idLZb1ZYP2WAVjj6m2+yKdsVxe85nTFgHSu4DwKoorcQdx0oMm0ZkBqt5UYjey X-Received: by 2002:a17:902:d81:: with SMTP id 1-v6mr30796606plv.324.1521854107698; Fri, 23 Mar 2018 18:15:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521854107; cv=none; d=google.com; s=arc-20160816; b=a8gg8GXMPNLwnw+MrbsysCg7wDNeQm5qQmnnW/KAjF3+jKaUm1WRFFLyRsy9PeRMcM u3qjtHKpnbsXLLZ4DD2eTikN0TakOEYfWVcnmLtoGV6KVBsdZ6X2oU5HJ+ba/O700UhB mJZCbTJVR0binUSbW6YyXuTG0jKA6G8ACR8zWS61hTwO276444hM28F2ZqVR+IPaDGni AZyPM6a6d2NBILyBrbztWke5TzDHJmcW3HZ328OSBxeo4HclhDZ+9M2X5VSnVFXf2haB m5ZDlPAbM83eHPhPGegfGof4OCGCecgS2yAC7pEhbocm9st32EsTOwuKVX97PfP38olf AY7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=zi7XLDws8ZZ3Y9boerJs+GnLXPMT18HD2jd6rlW5WbI=; b=xvHlYqN3B1oPUame4HpWJ5cEUiKGpTmlDYsPfqTB56hl1n/F2xQLhR7Yt3USwiV1Ha IzEwnicS2Hd84K5RJ8y8MXqp7MZijx8F9Qey4tgulwiZHxhERMgNPM5rk/MmzHlV8j9A zuxCYDEJecD86ehsmcp8oUxiK+dK3AqC61thkcIe97WOfiit0aPCSzvfxSfUqxwKAW0l q818Za05J/ve7cN4bYpIgCzP092rPigHKFa/6Q1eNH/EbCTt3G3OOFTHtG6Xh9T/qnbJ yJ7U6UAGZIXyeMcwIe2T0L4Rg0yn9ykJ6q3f7/W2gr7xZmxeGS+KAVTtfKFOQ/M4hKe4 eh+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=OlzVDNeD; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o127si698705pfo.88.2018.03.23.18.14.52; Fri, 23 Mar 2018 18:15:07 -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=@google.com header.s=20161025 header.b=OlzVDNeD; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751981AbeCXBN7 (ORCPT + 99 others); Fri, 23 Mar 2018 21:13:59 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:43798 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751715AbeCXBN6 (ORCPT ); Fri, 23 Mar 2018 21:13:58 -0400 Received: by mail-io0-f194.google.com with SMTP id q84so11702049iod.10 for ; Fri, 23 Mar 2018 18:13:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=zi7XLDws8ZZ3Y9boerJs+GnLXPMT18HD2jd6rlW5WbI=; b=OlzVDNeDAHDuWzNZh8YO+OT86H4yqcSv/iGL4SzklmMHD0JoM3WpMtwr2ajvj6WddN pMGB0leVtPMiEkNvrLlwQFLKkrkPQWX1f1NWO92/56whLVb+AM/ayeFICimEcuwtrUSU 2rvlH1yJR3TW+DH4+hGvWdTlAlcN1aFRwn4LQLpE25AlSC6AOLYBoEMgk+Bg5YmDb2py FgX96nRu4UjtTnWWH5DXfEGF17RlF/7LX1PE8SLU243sJmtpVeDKzsSCzcnJZWQ2NuNt cFwAUGqwGhT+J7LL1kTHmtLB/kqN85N5vd1Y3s7bavDINRzmeSXsGNuFmKjCXvSNvppF E9hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=zi7XLDws8ZZ3Y9boerJs+GnLXPMT18HD2jd6rlW5WbI=; b=OYvAEIoV6g5AT36XyrxC69idqhihtKZoXimyurLhkLsXW2IH/u/6+jsBCwwN4ztpFO 4J1yvJ1gKzKaGCKXi4nYt8fsEKCqXW6Ncn9YbsPnSSlfQj6SJIQ98udfS4ZEglrqh9kd 6DoJTRc/eerECGOj+wXzUHHCX4dxuHIRNniTYxe1uAXFJ6u540c4Xqbb4qfOBlNDooQ3 H2/oW/wKVx3mHAKhAh46tgdzVNHQ+rTvcCHVO4eCLWC93aoMaNDpsa1fQCn6TwNmsym7 8ydRofIlQAeL2ZIYxCU0m7f82Psie5o+zWBDvtVVkKy2dsZEmTj5OUKsgwbD+d8Oe3rt bSHg== X-Gm-Message-State: AElRT7GzafsB5nsjD+dn84C4fM6ts3WZh+vD9s3XTLEI8gd4s5y1hBvR BWkPCGZzjPgolnWtxXXlpCwtNuZAqXYjo8zGq8sjcejM X-Received: by 10.107.19.83 with SMTP id b80mr32717669ioj.251.1521854036734; Fri, 23 Mar 2018 18:13:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.11.158 with HTTP; Fri, 23 Mar 2018 18:13:56 -0700 (PDT) In-Reply-To: <20180323154745.GP4589@e105550-lin.cambridge.arm.com> 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> From: Joel Fernandes Date: Fri, 23 Mar 2018 18:13:56 -0700 Message-ID: Subject: Re: [RFC PATCH 5/6] sched/fair: Select an energy-efficient CPU on task wake-up To: Morten Rasmussen Cc: Patrick Bellasi , Dietmar Eggemann , LKML , Peter Zijlstra , Quentin Perret , Thara Gopinath , Linux PM , Chris Redpath , Valentin Schneider , "Rafael J . Wysocki" , Greg Kroah-Hartman , Vincent Guittot , Viresh Kumar , Todd Kjos Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Morten, On Fri, Mar 23, 2018 at 8:47 AM, 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? Yes. > 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. Yes, I see you had topology code that set SD_BALANCE_WAKE for ASYM. It makes sense to me then, thanks for the clarification. Still I feel it is a bit tedious/confusing when reading code to draw the conclusion about why sd is checked first before doing find_energy_efficient_cpu (and that sd will != NULL for ASYM systems). If energy_sd is set, then we can just proceed with EAS without checking that sd != NULL. This function in mainline is already pretty confusing as it is :-( Regards, - Joel