Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2334084imm; Tue, 4 Sep 2018 02:37:52 -0700 (PDT) X-Google-Smtp-Source: ANB0VdazsWX0qT3aY3/RjqpHTUqeOHl+FOQGnI/Q9695Ij8f/0CWsZYPNzQOjLOP/jfT159IuHbl X-Received: by 2002:a62:cc41:: with SMTP id a62-v6mr33742853pfg.131.1536053872464; Tue, 04 Sep 2018 02:37:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536053872; cv=none; d=google.com; s=arc-20160816; b=BJWxBReQpfmtipOu+ybbxpNYL7bgsXRU4z1sWwaI3RLuT3ELLLGd0jh8EnnmXhSbgi ef0C4/oU0OnhMGIZkka0z8t4KP+iCWAmvvE8scJv+ml0jn1OFdJBA10D38XqL5TJt0Ya ZCcTkJuiUH3SiZuoGl63nR3eqcAJoS37oPOOadHOYo6TZnv0cpd+oR+OMNd6xdxREmX0 4icGLtU0dngdx7xi9tcdNfVOX7umc/eXFea/lwPraSFrajZpnUcvuyLcqL0lFEW3X/Ip szu/BrxZuUip3RgNjuen4FYfzEslMvmpmjmQSnnh1POq2AlAZ5yQfXGxFe7rgTFrvQzb tjCg== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=fWvFRk2DF9cr4qOBjjQdzHJqXKr8I/4NJe4vlXpbS3Y=; b=doiY/CFBMaI6RW39NzUBWhj1yQSuQusSN7chV+Jd40rNSeWyl5E2z+XwoRtJjYT6Hw vJIYKetxNEJLrR4VtK+9mKjGW+BUJ1bqazU0POzUqywvrEaTLWdiovCDTzntHSj1VrrB 5xMv4uQZPFG1BlQFxu36RPQxH93Gzks7M30b+Zul+JNX7TPrWkjpuNUpG6PY0d9UWm8d JqUhE7vj/o0RN3USJXoq0/FycPeHZJoTykHRAEJttdn3dgACiWyen1ppaDL4+O0L4R6j HBpI8Y+QaN0VJ1ZIgiOGBcqcb/cHqHF6qWI75sFszviWzBLedXMSrRhuwe3o6ArHcRPn cd9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J3Z2yWzm; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c8-v6si18936800pls.407.2018.09.04.02.37.36; Tue, 04 Sep 2018 02:37:52 -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=@linaro.org header.s=google header.b=J3Z2yWzm; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726951AbeIDOAt (ORCPT + 99 others); Tue, 4 Sep 2018 10:00:49 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:32903 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726108AbeIDOAs (ORCPT ); Tue, 4 Sep 2018 10:00:48 -0400 Received: by mail-wm0-f66.google.com with SMTP id r1-v6so8675495wmh.0 for ; Tue, 04 Sep 2018 02:36:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=fWvFRk2DF9cr4qOBjjQdzHJqXKr8I/4NJe4vlXpbS3Y=; b=J3Z2yWzmXm80Xv27khGarIuBOUgimiIcFvQbTq2F49Bzbj0hzgcWSS3MdIBEiJy9L0 8Zi8he9kGw/pnaetqj25odiBG8bXcBqvity2qamLfw40f3kCUj2U074CJ+Jg0crgTOzC Qzn03QGHNbdp0wDuwFBGf0Gf4k2GCYN3JncsU= 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:content-transfer-encoding :in-reply-to:user-agent; bh=fWvFRk2DF9cr4qOBjjQdzHJqXKr8I/4NJe4vlXpbS3Y=; b=Xpw73UOu5rQH/yr4H7NL5sq6oXvhreVh5bjJsFBcXXLfSvDKNUz55pwb7H281rUkCg OPkfUP1urbmJ9WL2AtI9GohP3V/J3tWmYMBcM2uZV5bkoHVRE8A2xrH4b4g899vUhjB8 Hn8RiClWdTPKFyzH5lu9kUwG1a58hXr/fu7nienD1f1xZ9UGHYFn1/+ZWBCGTn2oZKM7 oxtOgTkaCvt6I16GwlPI6vuSyaXH22ysODyTsmTZgsD9j6XJeUZGw9un4K7RzGeNzdba DKi8jYIcUyk4qTuFLpv2UmzYeOn99LSUU6LaZKbWDIfjbC8VejTd02xeUv8/loPsD3FX aFzA== X-Gm-Message-State: APzg51AyVC6b6X7/ZotkiPIBxNUo9Hu4T8Tp1QvpGftQbuBh9FVUZQCr CXPj0yjb10lvQEPQiosIVNDmIQ== X-Received: by 2002:a1c:d946:: with SMTP id q67-v6mr7329817wmg.156.1536053789058; Tue, 04 Sep 2018 02:36:29 -0700 (PDT) Received: from linaro.org ([2a01:e0a:f:6020:7c65:f99f:5f34:3c07]) by smtp.gmail.com with ESMTPSA id q135-v6sm28751946wmd.4.2018.09.04.02.36.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Sep 2018 02:36:28 -0700 (PDT) Date: Tue, 4 Sep 2018 11:36:26 +0200 From: Vincent Guittot To: Srikar Dronamraju Cc: peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 3/4] sched/topology: remove smt_gain Message-ID: <20180904093626.GA23936@linaro.org> References: <1535548752-4434-1-git-send-email-vincent.guittot@linaro.org> <1535548752-4434-4-git-send-email-vincent.guittot@linaro.org> <20180904082424.GA2090@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180904082424.GA2090@linux.vnet.ibm.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Srikar, Le Tuesday 04 Sep 2018 ? 01:24:24 (-0700), Srikar Dronamraju a ?crit : > > Cc: Peter Zijlstra > > Cc: Ingo Molnar > > Cc: linux-kernel@vger.kernel.org (open list) > > Signed-off-by: Vincent Guittot > > diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h > > index 4a2e8ca..b1715b8 100644 > > --- a/kernel/sched/sched.h > > +++ b/kernel/sched/sched.h > > @@ -1758,9 +1758,6 @@ unsigned long arch_scale_freq_capacity(int cpu) > > static __always_inline > > unsigned long arch_scale_cpu_capacity(struct sched_domain *sd, int cpu) > > { > > - if (sd && (sd->flags & SD_SHARE_CPUCAPACITY) && (sd->span_weight > 1)) > > - return sd->smt_gain / sd->span_weight; > > - > > return SCHED_CAPACITY_SCALE; > > Without this change, the capacity_orig of an SMT would have been based > on the number of threads. > For example on SMT2, capacity_orig would have been 589 and > for SMT 8, capacity_orig would have been 148. > > However after this change, capacity_orig of each SMT thread would be > 1024. For example SMT 8 core capacity_orig would now be 8192. > > smt_gain was suppose to make a multi threaded core was slightly more > powerful than a single threaded core. I suspect if that sometimes hurt Is there system with both single threaded and multi threaded core ? That was the main open point for me (and for Qais too) > us when doing load balance between 2 cores i.e at MC or DIE sched > domain. Even with 2 threads running on a core, the core might look > lightly loaded 2048/8192. Hence might dissuade movement to a idle core. Then, there is the sibling flag at SMT level that normally ensures 1 task per core for such UC > > I always wonder why arch_scale_cpu_capacity() is called with NULL > sched_domain, in scale_rt_capacity(). This way capacity might actually Probably because until this v4.19-rcxx version, the rt scaling was done relatively to local cpu capacity: capacity ?= arch_scale_cpu() * scale_rt_capacity / SCHED_CAPACITY_SCALE Whereas now, it directly returns the remaining capacity > be more than the capacity_orig. I am always under an impression that > capacity_orig > capacity. Or am I misunderstanding that? You are right, there is a bug for SMT and the patch below should fix it. Nevertheless, we still have the problem in some other places in the code. Subject: [PATCH] sched/fair: fix scale_rt_capacity() for SMT Since commit: commit 523e979d3164 ("sched/core: Use PELT for scale_rt_capacity()") scale_rt_capacity() returns the remaining capacity and not a scale factor to apply on cpu_capacity_orig. arch_scale_cpu() is directly called by scale_rt_capacity() so we must take the sched_domain argument Fixes: 523e979d3164 ("sched/core: Use PELT for scale_rt_capacity()") Reported-by: Srikar Dronamraju Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 309c93f..c73e1fa 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7481,10 +7481,10 @@ static inline int get_sd_load_idx(struct sched_domain *sd, return load_idx; } -static unsigned long scale_rt_capacity(int cpu) +static unsigned long scale_rt_capacity(struct sched_domain *sd, int cpu) { struct rq *rq = cpu_rq(cpu); - unsigned long max = arch_scale_cpu_capacity(NULL, cpu); + unsigned long max = arch_scale_cpu_capacity(sd, cpu); unsigned long used, free; unsigned long irq; @@ -7506,7 +7506,7 @@ static unsigned long scale_rt_capacity(int cpu) static void update_cpu_capacity(struct sched_domain *sd, int cpu) { - unsigned long capacity = scale_rt_capacity(cpu); + unsigned long capacity = scale_rt_capacity(sd, cpu); struct sched_group *sdg = sd->groups; cpu_rq(cpu)->cpu_capacity_orig = arch_scale_cpu_capacity(sd, cpu); -- 2.7.4 > > -- > Thanks and Regards > Srikar Dronamraju >