Received: by 10.223.176.5 with SMTP id f5csp4372580wra; Tue, 30 Jan 2018 06:25:30 -0800 (PST) X-Google-Smtp-Source: AH8x227cNso/9mPIOg4SAEB6fgbXevkdPiDT3GTjDaY56gccSyAh9I6QWoMqwEQvFUttI73RkOdp X-Received: by 10.98.59.149 with SMTP id w21mr30338835pfj.7.1517322330467; Tue, 30 Jan 2018 06:25:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517322330; cv=none; d=google.com; s=arc-20160816; b=HSMy2Fys6B8mgZkOeAlVHU3NO7Y5vlKNO5W+kN/8Se/XwB9iwh/CFxs+S+k204oj+3 MgUZa+1WSS3Dq6LBAXAt51d8Jb2bFazHWciM7BmlEBEJJHIZT0arTPI68yTavyTuBgSO m7jELWfjZbn2HwTc/GTge00KznRh97VE7ahopHy7QxaY2N+zX2i1X6QxBbLpTJwcLppG q0dsZzcF5QoR1sATmQqj96hed2GtbEczBEQLAxFpCVUPt0OyoSo9baG8c/k2j6mmL0sX 6caTAQvs7eEuQonvCkb/8+10soe+L+C+0mf5cYYpRnEFjAYKT4nUvjf0Q6ZMSa2bmS29 kR8Q== 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=V62rnvDrTpVBWzsvOTK7YadHrnCSLk+BXPr7xwN1W2E=; b=ADKyQb86TvxRqfo/J+I5ApTZFHpkJi2EBsCq8eayfsr5yYqhUtu5lBxIGmdTq00Ahp znFB59Txn7tzFJcpyAKoRs8s9ScU5A9JAdND2NmXkS8iKcx6mH+xBNx21V6wNzVceiAf gXTnG5Wu/HP/AHNAg9xs4xTBlLvbn6F3+KzXsY6Zgsv0zCfsf8K+oC4XwDJkLDpKA9ag uxpk+cmTuFa0Hb6ygcdT8X2nud4camHdbHtDyNM3FRGLSG1m+Q4MBqRccLeKH+3pio81 x+p2BnM8PCYxN/Jn1IGUECtKxjxkmBbrWzJiZdeKXsGvgVXz3MLVTptqPuNjeLHnK7tM a3HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=BZXL83Ek; 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 30-v6si1949892plc.548.2018.01.30.06.25.16; Tue, 30 Jan 2018 06:25: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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=BZXL83Ek; 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 S1752850AbeA3OBk (ORCPT + 99 others); Tue, 30 Jan 2018 09:01:40 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:38041 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751786AbeA3OBi (ORCPT ); Tue, 30 Jan 2018 09:01:38 -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=V62rnvDrTpVBWzsvOTK7YadHrnCSLk+BXPr7xwN1W2E=; b=BZXL83EkQXwAbBYf3uncVghjZ Xrk9w2ZpDxIJUYDH6qcL5JPEc0oJku6A3Lh//edYZWt7dHzOXs0SS9Oxsu//QplciutFbxg+gaBPG LotxAmjAibsPXPTO6jpxGBUENfYLZWJBUkQPxubXFfDjhpv8TlJrbMdrVFw0GagVk+sJOrYyamHJy kBby43H333Sad3bAi6EeDiazmjYErgkp1fIbzd21VlEk54XEo6PEOvo/gjYhRrgd3q5hDb0Ol8cdU sJ+PUeVuqPEH3on77o4meTgGiHMeS5tbni1OEi+cThuAYj2tnEfAIp4LC5EadPHcjrG746yJzlbAj RHMlDIa8w==; 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 1egWTe-0005in-Q4; Tue, 30 Jan 2018 14:01:34 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 637A820298BA9; Tue, 30 Jan 2018 15:01:32 +0100 (CET) Date: Tue, 30 Jan 2018 15:01:32 +0100 From: Peter Zijlstra To: Patrick Bellasi 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: <20180130140132.GI2295@hirez.programming.kicks-ass.net> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180130130432.GC2269@hirez.programming.kicks-ass.net> 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, 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. > used at the time. But that's 4 dependent instructions (cqto,xor,sub,cmp) > whereas the one I proposed uses only 2 (add,cmp). > > 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. > > So yeah.... whatever ;-)