Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp21327205ybl; Mon, 6 Jan 2020 02:25:17 -0800 (PST) X-Google-Smtp-Source: APXvYqzjF5hx4IG67xB4fK1XM0LD7pitGN6Q3/6jaXyRcQQEpkvRWQQSj86wR726QOrO7c3UJZFm X-Received: by 2002:a05:6830:682:: with SMTP id q2mr6461642otr.31.1578306317007; Mon, 06 Jan 2020 02:25:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578306316; cv=none; d=google.com; s=arc-20160816; b=SGN+KR/aeU9GHB7u7q19ffNrAwsFTbuoNmSzQDi6T2ixtF24mSGutOw0jIN+KlpwH9 PJOswxXfgdZMHtBdnNFLTxz5FVjatKcsvPGS4oR+YQuwnTlmB/dgvZA04PUHu7EmYQLQ cZ5IUjd0X7B4zDZMfvFKB4JOcL+OJm+IFZU3U/NHk4UNDb2jBv/75h28e9OrwfgMGlm4 da8s0AWcoxL3C9MBRNr/V5Z76oJP3SmqIqKgPRfKfayOCiViUVcitg1/hXKAiDWuR0bq ouB65NTNsgWB2Gx6unojvZ2pbywI92cE6mKZDEAxrVz+LwkHqQ7fMh5/zT1rvVikSbUK TCYQ== 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=g9YBz3F+B0vv6Z8r9xsyYIVGQYxQAbmF8Qb3K4NcA+A=; b=xHnHqxUkRV/oByE6j4n53hv09avXHN9Iu50sQ48d0kMMLZx2crWfnESreAiYbphtVy StPM8mSZwSJitl+/2Q6/wo28R/KNisiI7bqjuZzhJ4v6WYSUkSjeI1/E2BfAj19Q3KT6 170wzz/hcwR/72YVXi/heXQfE9SRWuOicc3fU1cvCXx5tD73cob1EZKOzgJgyTsnBy81 73gbLtTkLoj7do0Si4lkGaQKvGq9nntt6w1Nf22zdb/wNmYxzzDEHZSYImSD5bvDUVee UrLbzAQjG+QUhqShIlUlTdvjKKvbkAKvG892c3F5f7TUX08S8rrijO46ZMu1ngTPQj33 4RDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=N+nS18zn; 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 c19si33089283otn.7.2020.01.06.02.25.04; Mon, 06 Jan 2020 02:25:16 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=N+nS18zn; 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 S1726524AbgAFKYJ (ORCPT + 99 others); Mon, 6 Jan 2020 05:24:09 -0500 Received: from merlin.infradead.org ([205.233.59.134]:40382 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726497AbgAFKYI (ORCPT ); Mon, 6 Jan 2020 05:24:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=g9YBz3F+B0vv6Z8r9xsyYIVGQYxQAbmF8Qb3K4NcA+A=; b=N+nS18znWKjmEYLgGbzrCg9tz IdcDn2h6JdIpBdWF0v5ZMOARbrN8br+d5EgzsfVfg1p3Ft9o4pW0UUvEssCtYXPegMTfUHF6oqq3P cMZdCUjLiWIvEzE/10F/tB8kG7TlFkQbJtyv7tgFJakLatFSio3Z6hKF01fSFf9ugR7I8TTXkONzE fWvApuW+voFa+eGzPLjzsyc9o7QDIhICoMTP3fsaOZ47XWrotAYMSvEplsimQEUUdHmZdR476wfgm y8YT7R95ZDt8OikrwOJzzZKgAnWrYzLxxQEJJ/rHZ+IL473lsq8eoLNpg+ZdW1F/dovgZSlm+Grmf FNbc592Yw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1ioPY0-0000tu-Dv; Mon, 06 Jan 2020 10:23:44 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 5E54B306CEE; Mon, 6 Jan 2020 11:22:09 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 5D9DA2B627478; Mon, 6 Jan 2020 11:23:41 +0100 (CET) Date: Mon, 6 Jan 2020 11:23:41 +0100 From: Peter Zijlstra To: Peng Liu Cc: linux-kernel@vger.kernel.org, mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, qais.yousef@arm.com, morten.rasmussen@arm.com, valentin.schneider@arm.com Subject: Re: [PATCH v2] sched/fair: fix sgc->{min,max}_capacity miscalculate Message-ID: <20200106102341.GM2810@hirez.programming.kicks-ass.net> References: <20200104130828.GA7718@iZj6chx1xj0e0buvshuecpZ> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200104130828.GA7718@iZj6chx1xj0e0buvshuecpZ> 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 Sat, Jan 04, 2020 at 09:08:28PM +0800, Peng Liu wrote: > commit bf475ce0a3dd ("sched/fair: Add per-CPU min capacity to > sched_group_capacity") introduced per-cpu min_capacity. > > commit e3d6d0cb66f2 ("sched/fair: Add sched_group per-CPU max capacity") > introduced per-cpu max_capacity. > > Here, capacity is the accumulated sum of (maybe) many CPUs' capacity. > Compare with capacity to get {min,max}_capacity makes no sense. Instead, > we should compare one by one in each iteration to get > sgc->{min,max}_capacity of the group. > > Also, the only CPU in rq->sd->groups should be rq's CPU. Thus, > capacity_of(cpu_of(rq)) should be equal to rq->sd->groups->sgc->capacity. > Code can be simplified by removing the if/else. > > Signed-off-by: Peng Liu > Reviewed-by: Valentin Schneider > --- > v1: https://lkml.org/lkml/2019/12/30/502 Please (for future use); use the form: https://lkml.kernel.org/r/$msgid