Received: by 10.223.185.116 with SMTP id b49csp950084wrg; Tue, 20 Feb 2018 10:27:14 -0800 (PST) X-Google-Smtp-Source: AH8x227WqQOdpoFu7yedWL1gZNmE+mAKALL3aw+eFoHYYziXTqwVh0mxYDE+qGSYl1TS3p4pW0Fw X-Received: by 10.98.185.24 with SMTP id z24mr493206pfe.185.1519151234717; Tue, 20 Feb 2018 10:27:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519151234; cv=none; d=google.com; s=arc-20160816; b=LIpBVESGsyIuvYB/p9eciSxp+Iw1uqqci0WAwzyQGW1jZRgALqYYD2ft1ILC+NnE4f NQKqZEQzjh0b61LoQgehKbVUtd+LTZaX5iRO8k4orvQhXb4nOfscesqyUHpnTffYCzUy c/igT1FGvRSlZ103mdb8RLOwaYJ7jtHJUt5QYckJrVEZTDLk5+dKxldYI22SEh5WWmQW 2WJV5xriU4ev/+uj4YASarnc0KMlA9mBX12cVptyx6bslAvSKYI4GqUPC33BdhivTguO N7XtMka8oXTBRBx5wKQ+hu2fQF1Yl5+JoiNO03lAJhxxiJ0QSr5f42zHFn5lPG1dy2TZ hnFg== 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:arc-authentication-results; bh=4IyGQUp4kPDP29ATY9uH5qngwSGbHCHOMzRwofu9KyI=; b=mgpSIiROpjAj2mG4EEomOCqZjF34OuzfPr+LJFSkTptzi7scU5UJTCWn/8MAYRao0L xIzKiUYwOXul4ATWNNylpwvQPqCXbXayUj+YwnVhIyrzjz7V4Mf0QBh4mWkYBJjqCyus 4R0K/LsFASlUz9Q8G10YmyVuv+yWKh/CBKFjqZhoQ2uoXAceaSncu246Q9TJFgr94pF2 nu0M9zhm82VqUDl+qYHon7XYJLZsEIEuI1s2om19/M3zB2CfqD08XkyAEMlAQRfNJ3fj FhbVf9BNxLZP4BgwJfW34Ue9JNRnXch7vOyu7dZgtuCoqs0uzNftJMh8s1+XU/y8fepJ HrCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=bJwVneVi; 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 x1si2220546pgv.124.2018.02.20.10.26.57; Tue, 20 Feb 2018 10:27:14 -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=bombadil.20170209 header.b=bJwVneVi; 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 S1752917AbeBTS0R (ORCPT + 99 others); Tue, 20 Feb 2018 13:26:17 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:58552 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752317AbeBTS0Q (ORCPT ); Tue, 20 Feb 2018 13:26:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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=4IyGQUp4kPDP29ATY9uH5qngwSGbHCHOMzRwofu9KyI=; b=bJwVneVi+JL/UHaIN2VkMW/jl sgZliT9fv66vm1oul7pzcWl7UYdB20AVnL8kP7VaWSD4B1kUY5mzWCbfrlwiDNlUugvFwOFSTia8o WvhGrw6tXSzvq4Rcqc3/QbZDjwOCX35SkeGqWqq9nrZLT2v2SiROwyvcEQKhx22v4sQYj2SA7xMLt C+y5hE71HBAKQjlZvMYAtMQUImm5sAuUUXkRL1zZXbEanGZpYZDAM4DL+mH7/AUkiHzBmPY7Idk+w azFf6gNIhd/fpZuVIxdNgcsQrc7ly60lXIHzf0kSiMXhWRob1ONgjHCIsVLTGdQm5afX2RnNx9oSx to5AiBD1A==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1eoCcB-0007QL-Oz; Tue, 20 Feb 2018 18:26:08 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id CB8172038E257; Tue, 20 Feb 2018 19:26:05 +0100 (CET) Date: Tue, 20 Feb 2018 19:26:05 +0100 From: Peter Zijlstra To: Morten Rasmussen Cc: mingo@redhat.com, valentin.schneider@arm.com, dietmar.eggemann@arm.com, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/7] sched/fair: Avoid unnecessary balancing of asymmetric capacity groups Message-ID: <20180220182605.GI25201@hirez.programming.kicks-ass.net> References: <1518711654-23503-1-git-send-email-morten.rasmussen@arm.com> <1518711654-23503-5-git-send-email-morten.rasmussen@arm.com> <20180219151011.GI25181@hirez.programming.kicks-ass.net> <20180220163352.GD4589@e105550-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180220163352.GD4589@e105550-lin.cambridge.arm.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 20, 2018 at 04:33:52PM +0000, Morten Rasmussen wrote: > On Mon, Feb 19, 2018 at 04:10:11PM +0100, Peter Zijlstra wrote: > > On Thu, Feb 15, 2018 at 04:20:51PM +0000, Morten Rasmussen wrote: > > > +/* > > > + * group_similar_cpu_capacity: Returns true if the minimum capacity of the > > > + * compared groups differ by less than 12.5%. > > > + */ > > > +static inline bool > > > +group_similar_cpu_capacity(struct sched_group *sg, struct sched_group *ref) > > > +{ > > > + long diff = sg->sgc->min_capacity - ref->sgc->min_capacity; > > > + long max = max(sg->sgc->min_capacity, ref->sgc->min_capacity); > > > + > > > + return abs(diff) < max >> 3; > > > +} > > > > This seems a fairly random and dodgy heuristic. > > I can't deny that :-) > > We need to somehow figure out if we are doing asymmetric cpu capacity > balancing or normal SMP balancing. We probably don't care about > migrating tasks if the capacities are nearly identical. But how much is > 'nearly'? > > We could make it strictly equal as long as sgc->min_capacity is based on > capacity_orig. If we let things like rt-pressure influence > sgc->min_capacity, it might become a mess. See, that is the problem, I think it this min_capacity thing is influenced by rt-pressure and the like. See update_cpu_capacity(), min_capacity is set after we add the RT scale factor thingy, and then update_group_capacity() filters the min of the whole group. The thing only ever goes down. But this means that if a big CPU has a very high IRQ/RT load, its capacity will dip below that of a little core and min_capacity for the big group as a whole will appear smaller than that of the little group. Or am I now terminally confused again?