Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp479290ybv; Fri, 7 Feb 2020 03:02:24 -0800 (PST) X-Google-Smtp-Source: APXvYqzH6ev2dQ9wHJ3ZUQwOl+r165f7vP1HeibCjQxxY6qSp0DeI4mZ0KU6OQGXILfzmTpEJSkg X-Received: by 2002:a05:6808:a9c:: with SMTP id q28mr1685038oij.176.1581073344828; Fri, 07 Feb 2020 03:02:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581073344; cv=none; d=google.com; s=arc-20160816; b=c1eBtoy0E4jH7+QNc6XHxcyNjhnktytGy5bZV/aExihHMojB+uXSbpF15WglhGq8dS FNDiTLpUeTXw6m37XNFZx2wNIMIhFVhRsZ7mNBnqys4ZD/feAgN2P+6TX8HuFmdA/pR9 KQz1hTY11PaZcQZvPvmzAvH1Ca3im/PBMMq713Kx1fWhcrlIcJqnccdOtisMVxHQJIII aEBl+5DPNbWszdF3lYaFtpwAhQYjB+P7rkdd++BFrjiShubHIyz1Cm22rkxtrWjqz2hI PxwuAuNdh5YPpz7nTinSLc9bDgIPRleU6Bc4V+DjQdlONhF3jRXetQ435EMf12Sg+x2l tdHQ== 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:dkim-signature; bh=W8AcEXT/rp+0zMDA+Sxx4tL9Ve5RCfDJTXhXGZXjlx8=; b=Y7TD6B1b48PF4Sqiogn40GsIn6gf6DYT2fOoDMRjPMGif2u7bLnRf50sO3F8YZR+5K svFAprcI9THpFxd/eDkDw39zgvDw0rIr4PRF50QJzWnikPSgWtB5Ttf1V7tRif2cDvkD DdiNirI+St0bXUraYadRtZVCrNbq1aanvbFBgwfezS5HxPZiJ19P8PUCQEymar89Yjbk OOgyTpX2xouzijJIc9s3sGt+9b5R6dAxgVsPcfpm5D1tMcG4L+LDNaQLrGk410+zXV40 cQ95qAGszHtdinz0lbx5iMlHf+ujNCSnK1FKvZCZ7AtR8MiXNFnduYYE6v+7rja922x/ 1Img== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=enSbUPCW; 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 q19si1465717otm.221.2020.02.07.03.02.10; Fri, 07 Feb 2020 03:02:24 -0800 (PST) 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=enSbUPCW; 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 S1726894AbgBGLBQ (ORCPT + 99 others); Fri, 7 Feb 2020 06:01:16 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:42477 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726674AbgBGLBQ (ORCPT ); Fri, 7 Feb 2020 06:01:16 -0500 Received: by mail-wr1-f68.google.com with SMTP id k11so2113903wrd.9 for ; Fri, 07 Feb 2020 03:01:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=W8AcEXT/rp+0zMDA+Sxx4tL9Ve5RCfDJTXhXGZXjlx8=; b=enSbUPCWnWIc6UKBGnavS5xw5jxPY78jfxEYeHw9vUhCuSeTfmw9VdfLV4xrU9hZfC d/XF/wqiGJzo4GCUFnfB6zajgD9iw4XWuep4C26Wz9H2Ki1VnKLCqKAnD6IPHVuuISjb ymjUz7yAc9HvbyKC9b9ZqLGb9GmbkBYpwYb7NFQGm5eJM7IUP0GWD7he6ZJKokb1sUnX o2aRCoUjS+U7sbPHZsOzzvlHavSBlrEpYr/KwQByVF6wxzwkHBFcFuDGVsFDQEHyRrIE HNPQ/22daouF06x/7PWYs02G4yQowaapqYioLIzWyrkJknkW0QYWXe7FjIPaMWW0QlWJ WMfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=W8AcEXT/rp+0zMDA+Sxx4tL9Ve5RCfDJTXhXGZXjlx8=; b=oj3FqZKCy+QIQnUxPSmwvauIUm+pRl9BrpLryVYsOKxdlPXjTW0yppO7dtoRkHIgnk DPStOUNqRF7sSzX1oWFlg5P4J8uL85bdapClXUxgbvdReThScxbcbCRQP0SRPA5BeUa5 TJPXn0VF9cMRrPg5z/8b4se4wQPLTUX63UOuU13pT/zygEJyuiXH9Wr8OAkWRriA0o1M SruaMIGIWq5CDZV7DMCYf7DJ0p2G2314Y20gBI9K3V+zZIcTp2jemWaYY5IGju4APbrn 1q3gpu97yv4q9QJvwbaHSO+VCK2U1gH5uTb9keTlWTRV1LZo8sndSFhG0FoEe5LkagCi oKGQ== X-Gm-Message-State: APjAAAX+rl3sd40Kz1FDrgmZWhhLsLWBXAZ7ZxWeE0nzQmciWiYWS9bH 7zocPZcpGMFBXe5bIQdoSqxPbA== X-Received: by 2002:a5d:4ec2:: with SMTP id s2mr3862919wrv.291.1581073273558; Fri, 07 Feb 2020 03:01:13 -0800 (PST) Received: from google.com ([2a00:79e0:d:110:d6cc:2030:37c1:9964]) by smtp.gmail.com with ESMTPSA id o4sm3094270wrw.15.2020.02.07.03.01.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2020 03:01:13 -0800 (PST) Date: Fri, 7 Feb 2020 11:01:09 +0000 From: Quentin Perret To: Valentin Schneider Cc: linux-kernel@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, morten.rasmussen@arm.com, adharmap@codeaurora.org, pkondeti@codeaurora.org Subject: Re: [PATCH v4 1/4] sched/fair: Add asymmetric CPU capacity wakeup scan Message-ID: <20200207110109.GB228234@google.com> References: <20200206191957.12325-1-valentin.schneider@arm.com> <20200206191957.12325-2-valentin.schneider@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200206191957.12325-2-valentin.schneider@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday 06 Feb 2020 at 19:19:54 (+0000), Valentin Schneider wrote: > From: Morten Rasmussen > > Issue > ===== > > On asymmetric CPU capacity topologies, we currently rely on wake_cap() to > drive select_task_rq_fair() towards either > - its slow-path (find_idlest_cpu()) if either the previous or > current (waking) CPU has too little capacity for the waking task > - its fast-path (select_idle_sibling()) otherwise > > Commit 3273163c6775 ("sched/fair: Let asymmetric CPU configurations balance > at wake-up") points out that this relies on the assumption that "[...]the > CPU capacities within an SD_SHARE_PKG_RESOURCES domain (sd_llc) are > homogeneous". > > This assumption no longer holds on newer generations of big.LITTLE > systems (DynamIQ), which can accommodate CPUs of different compute capacity > within a single LLC domain. To hopefully paint a better picture, a regular > big.LITTLE topology would look like this: > > +---------+ +---------+ > | L2 | | L2 | > +----+----+ +----+----+ > |CPU0|CPU1| |CPU2|CPU3| > +----+----+ +----+----+ > ^^^ ^^^ > LITTLEs bigs > > which would result in the following scheduler topology: > > DIE [ ] <- sd_asym_cpucapacity > MC [ ] [ ] <- sd_llc > 0 1 2 3 > > Conversely, a DynamIQ topology could look like: > > +-------------------+ > | L3 | > +----+----+----+----+ > | L2 | L2 | L2 | L2 | > +----+----+----+----+ > |CPU0|CPU1|CPU2|CPU3| > +----+----+----+----+ > ^^^^^ ^^^^^ > LITTLEs bigs > > which would result in the following scheduler topology: > > MC [ ] <- sd_llc, sd_asym_cpucapacity > 0 1 2 3 > > What this means is that, on DynamIQ systems, we could pass the wake_cap() > test (IOW presume the waking task fits on the CPU capacities of some LLC > domain), thus go through select_idle_sibling(). > This function operates on an LLC domain, which here spans both bigs and > LITTLEs, so it could very well pick a CPU of too small capacity for the > task, despite there being fitting idle CPUs - it very much depends on the > CPU iteration order, on which we have absolutely no guarantees > capacity-wise. > > Implementation > ============== > > Introduce yet another select_idle_sibling() helper function that takes CPU > capacity into account. The policy is to pick the first idle CPU which is > big enough for the task (task_util * margin < cpu_capacity). If no > idle CPU is big enough, we pick the idle one with the highest capacity. > > Unlike other select_idle_sibling() helpers, this one operates on the > sd_asym_cpucapacity sched_domain pointer, which is guaranteed to span all > known CPU capacities in the system. As such, this will work for both > "legacy" big.LITTLE (LITTLEs & bigs split at MC, joined at DIE) and for > newer DynamIQ systems (e.g. LITTLEs and bigs in the same MC domain). > > Note that this limits the scope of select_idle_sibling() to > select_idle_capacity() for asymmetric CPU capacity systems - the LLC domain > will not be scanned, and no further heuristic will be applied. > > Signed-off-by: Morten Rasmussen > Co-developed-by: Valentin Schneider > Signed-off-by: Valentin Schneider Reviewed-by: Quentin Perret Thanks, Quentin