Received: by 10.223.185.116 with SMTP id b49csp908023wrg; Fri, 23 Feb 2018 08:39:04 -0800 (PST) X-Google-Smtp-Source: AH8x2267tF2I6Nq9owORIy/Y8fyMtHwuPjss7NOPxrKZ/RcM5o7PJuST3ZivSyYeWDLcHTMQqJHg X-Received: by 2002:a17:902:981:: with SMTP id 1-v6mr2272056pln.345.1519403944367; Fri, 23 Feb 2018 08:39:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519403944; cv=none; d=google.com; s=arc-20160816; b=qQbS1paWBSvn3DHTpyAY5RC2wfiJfIjYjU0nxCC9P671DYSNKQVgdQYmDDQQZeNs8g OAPagNy+T91RT05gfLsove1rUVqDDwlpolqLzmNKzR2K84QldRPODTfLyfk9Bzo7RAiy 07cl3RSeF8v3kQzeytLzbc2fJ6dBUt5FZoSMjjce3IM270ohEeg/hcpLG3n5RHvnbR0H jN0hLEg+qfx5/WPtfxFfVlyz6KPutoE6EMfRoVl2kh2Zgfk5OkcS+qVOvviJ+wn1FdbR 2UnRRH/cg7FD1UCSCTNaKVQngAukhfRKSty4PpW+CjyvTC66cc8VoLbZoIDpSw2utbbq 7TCQ== 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:arc-authentication-results; bh=l4i4U+d2Ban0zYG0+f4LNz0++xIg2q2f9ZBGhzpb02E=; b=TXsz0LxXgGlF1jtgAvl+T2+ui9kY//HBijR7WoMRcRwVQm4gETGT8Ve8Qkei7kWrBI ahNr3ojqmZriwf04ffL2fG9zpPT7cThCCMT52CTFegCerBfDLtfOGQhYhtcd9bYhO0P7 OfbUD/S2Dwbjh3JoyKLgqH5/ETP6/KOWltTwVdj53IMhpqpW7YNSbBp45qDDGXBkPv8n yZhAypX079FufH6sPNF9U1VrwrHykSjetEd5CDci6wdEd82R7gDuVztuXIgra2fwZVPI 3gP4uO8AoP6obvDp+IPGjYsKjsqE7b6CYevCU1N4IJS+4HWJYhlAh+a5pDiAX2HO3L/Y YPow== ARC-Authentication-Results: i=1; mx.google.com; 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 d6si1714746pgu.400.2018.02.23.08.38.49; Fri, 23 Feb 2018 08:39:04 -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; 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 S1751928AbeBWQiL (ORCPT + 99 others); Fri, 23 Feb 2018 11:38:11 -0500 Received: from foss.arm.com ([217.140.101.70]:57878 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751600AbeBWQiK (ORCPT ); Fri, 23 Feb 2018 11:38:10 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C12591529; Fri, 23 Feb 2018 08:38:09 -0800 (PST) Received: from e105550-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8EE6F3F25C; Fri, 23 Feb 2018 08:38:08 -0800 (PST) Date: Fri, 23 Feb 2018 16:38:06 +0000 From: Morten Rasmussen To: Peter Zijlstra 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: <20180223163806.GE4589@e105550-lin.cambridge.arm.com> 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> <20180220182605.GI25201@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180220182605.GI25201@hirez.programming.kicks-ass.net> 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 On Tue, Feb 20, 2018 at 07:26:05PM +0100, Peter Zijlstra wrote: > 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? No, I think you are right, or I'm equally confused. I don't think we can avoid having some sort of margin to decide when capacities are significantly different if we want to keep this patch. Looking more into this, I realized that we do already have similar comparison and margin in group_smaller_cpu_capacity(). So I'm going to look using that instead if possible. The commit message could use some clarification too as we do in fact already use group_smaller_cpu_capacity() to bail out of pulling big tasks from big cpus to little. However, there are cases where it is fine to have sum_nr_running > group_weight on the big side and cases where it is fine to have the bigs idling while the littles are lightly utilized which should be addressed by this patch.