Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3358095pxf; Mon, 15 Mar 2021 07:55:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy42wWN7nDW4EYbz216do1ETxeaIGtXiV2dpjG2qf3C+f94WzY9ith716KE/3XMr7xCPT35 X-Received: by 2002:a17:906:aed6:: with SMTP id me22mr24227668ejb.146.1615820119864; Mon, 15 Mar 2021 07:55:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615820119; cv=none; d=google.com; s=arc-20160816; b=0ygxXlle/+MONvjrNSfuerXCzywGg0/nHXpcF0Y7yr+Rto1pIsuFYLMrbzBVe13Rev 7aaF66fCX/m2XS5e9b9L0ELjij/149bfMtZE1F/dQK0AnCTKTjOUTx+/WX6KO7J7/j0m dI5mQb6eut+hnsqDkQL5Mqf7M7y0nYtrIkuOzDGw7U6hnWr46Kxgqlirvtvvl7xlv/C5 +US5q5sjMH4ri+Hk6QRZS+v9gYAlRgTbkVIfQs52AC3wgPYWl8RHRyoRbkmyKKLxxcdD IjVfCtdHXcxmrHnucJM7Q+s4cSaNJtJLUmNDAthRyNKof4PojZBUwBU/Z/YHNJE1CWml P4Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=7ycRI+EUL60Frat+dcTTqOlzXPNrC+V8NzgLq8y0+t0=; b=MOVqYWBdg7RX3/8ID6ROGWhcqNI5We09duv5FmNApbEyX0L8W64IjPRT/YMKU2WUSj 9mcXIoDerJupr1T1a2VrnQry9TFeN+SKzffQ7qpQ4ZZacMQvu1XHekS4A5233iLVqlFG Xmpy6AVuVpFeJxuRBUr20+6oPr97t5d2ag9Ea0cyNaXkmWSh1e+hgSKaLFTYnF3N1eib p8OdxSE+dhswg7kgzuwnv6xdCj9myUk9V6NAWj4vonmeqGREc0DgXW2mEJXNEn3G783i 3bqzGaDGEOgs+u1EfxP1zdfLgS7lWiCCSxqFZ6s50aFtFyTQF1BmHAaHmmsf2oWV2qIt ZABw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sbKOxNDE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d10si11199197edp.256.2021.03.15.07.54.57; Mon, 15 Mar 2021 07:55:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sbKOxNDE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234450AbhCOOtr (ORCPT + 99 others); Mon, 15 Mar 2021 10:49:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234231AbhCOOYx (ORCPT ); Mon, 15 Mar 2021 10:24:53 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2AA5C06174A for ; Mon, 15 Mar 2021 07:24:50 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id z8so16446594ljm.12 for ; Mon, 15 Mar 2021 07:24:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7ycRI+EUL60Frat+dcTTqOlzXPNrC+V8NzgLq8y0+t0=; b=sbKOxNDEJsVSdxm5LxIMPOnKlwOt3XHq338W+CG1BuSo2dt43yu8WrmJ+ALvS5vtLD 3UWrK69oAfrZXp5dSc2X6qFKpbZcioFNDOkBf18KB6o4FYAmVgapzXH36XCdDBcnmoW/ ssg5LW/sbZIOcNdUm/Gi7DByCwnX15wmx4FjFzl5agHjP4jZ15LZrP+8RA0grOn0/BqH 4GuaEP5JOYouofhpFS+mtuSMlDFBy1MLIsiJux8tIvtLDjaYfdhMZSCtGvpwFoF8Evr9 wKiwislkFgFygZ+Oz4xZzP4a+i56XxmpuT2+217Fpb8zEMrwVV/ZLK2jbKEu2lpT+mr2 w5sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7ycRI+EUL60Frat+dcTTqOlzXPNrC+V8NzgLq8y0+t0=; b=nEKpLr0l3CsV296spVKDeK46XY4YuCzUJK5fPZmDeSSkzHl3g0yLF+47KQY55RjohW 48/xqTUgLrzSBAiZSBsW+/WRh52A8ONSCNFRnSci9+/fZhpnsmzWlGlF9WYLlSUm4BBG zni16fmJBZo/72def+UvQjzKyhft2Rfi+wTlFtL8fSOSP2wEYU0pRtLwZVVsHTg6StJF gsWx8GWa+F7OSqoZ/4Rt1mHDfyh8AOjNidAxCxEfYcmdm2uEWVEwTJEyyWuLJjnraPUj ZoaHjlqoY0jATQYcBIQUG0JG6GxwNtKfUSSOiWC2syobsF/8jycYyji5HQxbrvo/4P7w OPtQ== X-Gm-Message-State: AOAM531TmmXzZHk+jeAyvFcLNAAB4M+EamScgDyRZy5ewaYr4OXUpLdI Ojokg3ceN8hTMeGFHSkOdN0EDlOvNvN1V/wm22ZyaA== X-Received: by 2002:a05:651c:282:: with SMTP id b2mr10303034ljo.176.1615818289488; Mon, 15 Mar 2021 07:24:49 -0700 (PDT) MIME-Version: 1.0 References: <20210311120527.167870-1-valentin.schneider@arm.com> <20210311120527.167870-5-valentin.schneider@arm.com> In-Reply-To: <20210311120527.167870-5-valentin.schneider@arm.com> From: Vincent Guittot Date: Mon, 15 Mar 2021 15:24:36 +0100 Message-ID: Subject: Re: [PATCH v3 4/7] sched/fair: Introduce a CPU capacity comparison helper To: Valentin Schneider Cc: linux-kernel , Qais Yousef , Peter Zijlstra , Ingo Molnar , Dietmar Eggemann , Morten Rasmussen , Quentin Perret , Pavan Kondeti , Rik van Riel , Lingutla Chandrasekhar Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 11 Mar 2021 at 13:05, Valentin Schneider wrote: > > During load-balance, groups classified as group_misfit_task are filtered > out if they do not pass > > group_smaller_max_cpu_capacity(, ); > > which itself employs fits_capacity() to compare the sgc->max_capacity of > both groups. > > Due to the underlying margin, fits_capacity(X, 1024) will return false for > any X > 819. Tough luck, the capacity_orig's on e.g. the Pixel 4 are > {261, 871, 1024}. If a CPU-bound task ends up on one of those "medium" > CPUs, misfit migration will never intentionally upmigrate it to a CPU of > higher capacity due to the aforementioned margin. > > One may argue the 20% margin of fits_capacity() is excessive in the advent > of counter-enhanced load tracking (APERF/MPERF, AMUs), but one point here > is that fits_capacity() is meant to compare a utilization value to a > capacity value, whereas here it is being used to compare two capacity > values. As CPU capacity and task utilization have different dynamics, a > sensible approach here would be to add a new helper dedicated to comparing > CPU capacities. > > Reviewed-by: Qais Yousef > Signed-off-by: Valentin Schneider > --- > kernel/sched/fair.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index db892f6e222f..ddb2ab3edf6d 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -113,6 +113,13 @@ int __weak arch_asym_cpu_priority(int cpu) > */ > #define fits_capacity(cap, max) ((cap) * 1280 < (max) * 1024) > > +/* > + * The margin used when comparing CPU capacities. > + * is 'cap1' noticeably greater than 'cap2' > + * > + * (default: ~5%) > + */ > +#define capacity_greater(cap1, cap2) ((cap1) * 1024 > (cap2) * 1078) defined but not used. Should be merged with next patch which start to use it > #endif > > #ifdef CONFIG_CFS_BANDWIDTH > -- > 2.25.1 >