Received: by 10.223.176.5 with SMTP id f5csp4283881wra; Tue, 30 Jan 2018 05:05:55 -0800 (PST) X-Google-Smtp-Source: AH8x226ZdctvHcobhjBX7RJBDtIgbIi7bAxKvSbQ7MVtjefJFgGw4E6vRJXMqiIkUguzUT95kVSY X-Received: by 10.98.170.24 with SMTP id e24mr30253076pff.177.1517317555172; Tue, 30 Jan 2018 05:05:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517317555; cv=none; d=google.com; s=arc-20160816; b=t60Q2tDIKSWGPW2uikzphkLgxP5OPkaYwyPS2PoercvPSeBeztZa1ijt1KKKjLvCpx HmaNMMSLNXyrPOO+ZJqgcawwdoZf7mKKdtpwutnPLD8iHjrNgIDAEH7xeJs4EsonD01H JUZcHJgM+5P0/YP5H72OaHPEjO/OSrPvlhTv67l2FbFHSxRumsuprVfT/j0BIwyG5hRr RUJ86i4T5D6Ax7QKuuG2HIWHBRVo5Vc3R8u1tjQn2oeTwayZhcWkM4gqp/UuUW0BpjFe SCGiti6Rz33Mp6QReGwzsMrNqsIxDomg35Q9E7e5IF3LW7EhIWK10Y2POrff2ZVi+gH3 fAhQ== 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=Tc/6m29reEYa6G6mWgydE01hpyIPn0id8eChGaK2lGs=; b=mfBnAs2U4ZaTmPjox/Bvfi4nFHf06RVHHFKvr1Ukbi4+2uqRNEEIYWgy0w1suAwXTs qIIWpKcfmRjVhk20ykfX0zmps3w7j4GFNgVO4hdDZE6toalPL04TSqsygigWkEARib8R AWzYsZUTJ3e9+MF1tt5YoPoKwJQ0RO1zqAOKY00hKwEySrzpMzPBrnTqmXCGiLP1vi8X udp0JlINcU/FLO7BKFztBfGErtz7DQkX/+2EPwi0LsUjgPZ79VI/JN330J6rFJ4LKHo0 1BH2XskotR73dbjaqwd44jB0Ftg5YsIIQfamIA75+VQ32/8oz0fCzFL9aWQ9dE/Oxvop wWig== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=nVAHtOj6; 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 a33-v6si11744241pli.154.2018.01.30.05.05.40; Tue, 30 Jan 2018 05:05:55 -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=nVAHtOj6; 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 S1752143AbeA3NEl (ORCPT + 99 others); Tue, 30 Jan 2018 08:04:41 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:55613 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751821AbeA3NEj (ORCPT ); Tue, 30 Jan 2018 08:04:39 -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=Tc/6m29reEYa6G6mWgydE01hpyIPn0id8eChGaK2lGs=; b=nVAHtOj6gI4Tyr8D+C7BFxmSj BxVxtgIh2+eIh1uLWlOpwkqQOlNH0kdX2WXfyGyzATq4L4evYEHn48w6SYdg9J9XYbomuyWnamlvE JdP9cgfQxUESTobwHoKVujnnVwtNDSuqyMQnfTSKfXU+r5/SOHze1z+YqEarME2xxzSRO2xIaPueS NSYtMNbO03vvbFrFCuD1JZR/k2Sfq653zwKM9pL0Htkto/hgmKL+rPRKxzD9I/4ZUcrkXlsdQPzAZ obY8XY27WZ+mA3VeKvw6c+KlqEk10I5wKyfg70YUP2ksQhiOi1vI6LDAmPONUkAfGQ+b6UBhSj03e wJmaxHToQ==; 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 1egVaV-0000an-OK; Tue, 30 Jan 2018 13:04:35 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id CC5FA2029B115; Tue, 30 Jan 2018 14:04:32 +0100 (CET) Date: Tue, 30 Jan 2018 14:04: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: <20180130130432.GC2269@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180130124632.GC5739@e110439-lin> 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 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 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 ;-)