Received: by 10.223.176.5 with SMTP id f5csp2787745wra; Mon, 5 Feb 2018 09:50:30 -0800 (PST) X-Google-Smtp-Source: AH8x226Yi+iaNrmNcGcaN5NO2ttZU4LAuZ5bjJcNdJ68M+DnzU5WYiV7od3/CdJbgUD+rCHOaTzF X-Received: by 2002:a17:902:7c18:: with SMTP id x24-v6mr23233934pll.432.1517853030680; Mon, 05 Feb 2018 09:50:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517853030; cv=none; d=google.com; s=arc-20160816; b=ky+y1Vqz577NCilAQzbKw8XA5wqF++UnW2Y1tOYY9Mk9P8z0h2saPE5TDdQIo3hwMi wW7qdP4jpbZCaLhD2L6fd09wmp5OWTIFAbra5WMxmRTRimtKMjDliV/835emrxqIQpx1 F7qzkILWIssSIWon4sllcu18g2CAVBDMsB4qGEDGpjR/jlR5uRWbKHMnELrt5KC5LPdC WpH00R0WhFOJFEOr/Ry9FTTpZl8q6iEeaDodEKOC6TFO6AApIkCQzpNnWgeJm6dQCsin TydwaHatPOC3txFkWuPIVjKYND7RMky3cC9NIkuftUuFsei4bzhkOk+qeLcywedSIUHu LYkg== 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=61RkqpXhml3zjkRl1Pq1Hvl3LmY4tykxT3rEMAREV80=; b=HxmF7BfsmKgytnSqdhCjbegOZgmO++abEhOtqP1wR8WUgI2jK8h8qDLWKyoaG6tyN5 tpi6cJQen4nh4HC+rrjQFuK6QhnS1jKbQX+9+tsNZFshVheLyCIHYuzjFFwid7gur8DC K9bmxMB68S+zVX7ss/dhDwJ0d0iPu6G3xcthGC/EK2DJefZQAiecI3MgVRtQsQL4ozN1 L/UN0ByppaezY72SmYL+krHqE3Zrek9Qrtk6WC7T5kBESn87ekTHVmjEc00GOABqbALo FOcE7uvuNsnbt7+zYYWIkOyZA0w4v5VIA9zdO8oX3+riydU+9qKG9Ct1nTPelZGYS4y2 j4IA== 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 u87si6699051pfj.41.2018.02.05.09.50.16; Mon, 05 Feb 2018 09:50:30 -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 S1753420AbeBERtW (ORCPT + 99 others); Mon, 5 Feb 2018 12:49:22 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53816 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752722AbeBERtQ (ORCPT ); Mon, 5 Feb 2018 12:49:16 -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 3AE571435; Mon, 5 Feb 2018 09:49:16 -0800 (PST) Received: from e110439-lin (e110439-lin.cambridge.arm.com [10.1.210.68]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D3B343F25C; Mon, 5 Feb 2018 09:49:13 -0800 (PST) Date: Mon, 5 Feb 2018 17:49:11 +0000 From: Patrick Bellasi To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Ingo Molnar , "Rafael J . Wysocki" , Viresh Kumar , Vincent Guittot , Paul Turner , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Todd Kjos , Joel Fernandes , Steve Muckle Subject: Re: [PATCH v3 1/3] sched/fair: add util_est on top of PELT Message-ID: <20180205174911.GE5739@e110439-lin> References: <20180123180847.4477-1-patrick.bellasi@arm.com> <20180123180847.4477-2-patrick.bellasi@arm.com> <20180129163642.GF2228@hirez.programming.kicks-ass.net> <20180130124632.GC5739@e110439-lin> <20180130130432.GC2269@hirez.programming.kicks-ass.net> <20180130140132.GI2295@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180130140132.GI2295@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 30-Jan 15:01, Peter Zijlstra wrote: > On Tue, Jan 30, 2018 at 02:04:32PM +0100, Peter Zijlstra wrote: > > On Tue, Jan 30, 2018 at 12:46:33PM +0000, Patrick Bellasi wrote: > > > > Aside from that being whitespace challenged, did you also try: > > > > > > > > if ((unsigned)((util_est - util_last) + LIM - 1) < (2 * LIM - 1)) > > > > > > No, since the above code IMO is so much "easy to parse for humans" :) > > > > Heh, true. Although that's fixable by wrapping it in some helper with a > > comment. > > > > > But, mainly because since the cache alignment update, also while testing on a > > > "big" Intel machine I cannot see regressions on hackbench. > > > > > > This is the code I get on my Xeon E5-2690 v2: > > > > > > if (abs(util_est - util_last) <= (SCHED_CAPACITY_SCALE / 100)) > > > 6ba0: 8b 86 7c 02 00 00 mov 0x27c(%rsi),%eax > > > 6ba6: 48 29 c8 sub %rcx,%rax > > > 6ba9: 48 99 cqto > > > 6bab: 48 31 d0 xor %rdx,%rax > > > 6bae: 48 29 d0 sub %rdx,%rax > > > 6bb1: 48 83 f8 0a cmp $0xa,%rax > > > 6bb5: 7e 1d jle 6bd4 > > > > > > Does it look so bad? > > > > Its not terrible, and I think your GCC is far more clever than the one I > > To clarify; my GCC at the time generated conditional branches to compute > the absolute value; and in that case the thing I proposed wins hands > down because its unconditional. > > However the above is also unconditional and then the difference is much > less important. I've finally convinced myself that we can live with the "parsing complexity" of your proposal... and wrapped into an inline it turned out to be not so bad. > > used at the time. But that's 4 dependent instructions (cqto,xor,sub,cmp) > > whereas the one I proposed uses only 2 (add,cmp). The ARM64 generated code is also simpler. > > Now, my proposal is, as you say, somewhat hard to read, and it also > > doesn't work right when our values are 'big' (which they will not be in > > our case, because util has a very definite bound), and I suspect you're > > right that ~2 cycles here will not be measurable. Indeed, I cannot see noticeable differences if not just a slightly improvement... > > > > So yeah.... whatever ;-) ... I'm going to post a v4 using your proposal ;-) Thanks Patrick -- #include Patrick Bellasi