Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3252517imc; Wed, 13 Mar 2019 12:49:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxn+qLACGwiFAybDlQnm/YyTeHDAtzXu28R4hH/N2v7T+PA+M64L6YySaXYGZvz2GEadlRc X-Received: by 2002:a17:902:6b48:: with SMTP id g8mr47306040plt.21.1552506566575; Wed, 13 Mar 2019 12:49:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552506566; cv=none; d=google.com; s=arc-20160816; b=Sn/IJ1BuiAQ3Wjaf/Vc1qlSh1nynvj1xFUu8pPYt3ARtw+AKLBrjHNTZ+SWhfmkwtq 5hd1M4RWq6z95wa6ZpumuryI/Jm+cK6BxgHTJSZ0ndDY1dsK6uqfg/0ynCH/xYBiNgd4 MQWRuTPjIRmiQl8OtbMFKcr81MYgtMtvKNdgnwbXW6KpgAJbftuNu4Dff3H1fVWDcod/ DqbOPuIQIME+wxlBt/Gqqvuge7V8qAuumuLWImibqU0gDOvONWTjttkvoXj/BM3g/Puh tbDioXdSCHwt3ZR8LTN6iYA1/qVqGQCxabhpKTeG7WSvGTL6IjJ5PwOZa5kJbNEDAR0B eWqg== 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; bh=V6lzSncR4c6/O8KiDJNk5Af5QmZYSSOITe6zHzShbrQ=; b=p/xcBIz4+96N/x0QC1l/Bh13v0PN7Gjc53cvLFOSeVLl+cWZmlYVAWMWjkqj+K66ON U0r7bEDtwoJkdLU2O6Pw3xn4RlxSEeZ20qpv6L6DFNay70MdgweVtx4zUql50WQSX1a0 stHJyuXIxf94l6M+Qzg9PLZxZroCJ7n51UTRvxszeAzme46kO6Lc2eBW36yGXOPQgHaS HcVBIRZUcLgb69TZKTMS6AEzFqnjQ3GwFY3oQM1dMoEnE72RbbmqDY5KhhPv4BH7PZwb qntotDdV35WzYtUfDeO9R9xvZrjE965eMMMsOwoV4gy7pp6bcUQRbatFthcwKNW6KBgr 2v+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=QlznlU3D; 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 j187si11276180pfc.251.2019.03.13.12.49.09; Wed, 13 Mar 2019 12:49:26 -0700 (PDT) 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=QlznlU3D; 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 S1727065AbfCMTss (ORCPT + 99 others); Wed, 13 Mar 2019 15:48:48 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:40898 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726328AbfCMTss (ORCPT ); Wed, 13 Mar 2019 15:48:48 -0400 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=V6lzSncR4c6/O8KiDJNk5Af5QmZYSSOITe6zHzShbrQ=; b=QlznlU3DHxAKi03ReeJvSzNRm MJDAtP4DEBL0AAkP3gWjpjyNoiHsmEcbw37COEAheAYGThD0KAsiNER2YrF8tNOaDen7Ktitdd3Lf fEBAoMpGi9TrTFWBh02LqR+T1sn8QUOk22EEm/UyQXxJx54KGHS3iKPVcLGC91HgLlD3XUl5ziOHd OL9/xPWcGvNLtOLUD3Z8k6hGPbOhVffd3YZhYTlVNmlm5H5GMrHb3dEJXrLxLNayGsosPW/weA5ON q6+bx7S18yQEqKiJ5q3zXYB01dgNL1x6HtU2pDeJ2cGUPOkW2YyN26NwiifKWXhoD/ApdnmehG6hP yb0D1RFjw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1h49rm-0002N0-06; Wed, 13 Mar 2019 19:48:42 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id EF2569826C0; Wed, 13 Mar 2019 20:48:38 +0100 (CET) Date: Wed, 13 Mar 2019 20:48:38 +0100 From: Peter Zijlstra To: Patrick Bellasi Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, linux-api@vger.kernel.org, Ingo Molnar , Tejun Heo , "Rafael J . Wysocki" , Vincent Guittot , Viresh Kumar , Paul Turner , Quentin Perret , Dietmar Eggemann , Morten Rasmussen , Juri Lelli , Todd Kjos , Joel Fernandes , Steve Muckle , Suren Baghdasaryan Subject: Re: [PATCH v7 01/15] sched/core: uclamp: Add CPU's clamp buckets refcounting Message-ID: <20190313194838.GS2482@worktop.programming.kicks-ass.net> References: <20190208100554.32196-1-patrick.bellasi@arm.com> <20190208100554.32196-2-patrick.bellasi@arm.com> <20190313134022.GB5922@hirez.programming.kicks-ass.net> <20190313161229.pkib2tmjass5chtb@e110439-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190313161229.pkib2tmjass5chtb@e110439-lin> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 13, 2019 at 04:12:29PM +0000, Patrick Bellasi wrote: > On 13-Mar 14:40, Peter Zijlstra wrote: > > On Fri, Feb 08, 2019 at 10:05:40AM +0000, Patrick Bellasi wrote: > > > +static inline unsigned int uclamp_bucket_id(unsigned int clamp_value) > > > +{ > > > + return clamp_value / UCLAMP_BUCKET_DELTA; > > > +} > > > + > > > +static inline unsigned int uclamp_bucket_value(unsigned int clamp_value) > > > +{ > > > + return UCLAMP_BUCKET_DELTA * uclamp_bucket_id(clamp_value); > > > > return clamp_value - (clamp_value % UCLAMP_BUCKET_DELTA); > > > > might generate better code; just a single division, instead of a div and > > mult. > > Wondering if compilers cannot do these optimizations... but yes, looks > cool and will do it in v8, thanks. I'd be most impressed if they pull this off. Check the generated code and see I suppose :-)