Re: [PATCH v7 01/15] sched/core: uclamp: Add CPU's clamp buckets refcounting
From: Peter Zijlstra <peterz@infradead.org>
Date: 2019-03-13 19:48:49
Also in:
linux-pm, lkml
From: Peter Zijlstra <peterz@infradead.org>
Date: 2019-03-13 19:48:49
Also in:
linux-pm, lkml
On Wed, Mar 13, 2019 at 04:12:29PM +0000, Patrick Bellasi wrote:
On 13-Mar 14:40, Peter Zijlstra wrote:quoted
On Fri, Feb 08, 2019 at 10:05:40AM +0000, Patrick Bellasi wrote:quoted
+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 :-)