lkml.org 
[lkml]   [2018]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 5/7] sched: loadavg: make calc_load_n() public
On Wed, May 09, 2018 at 11:49:06AM +0200, Peter Zijlstra wrote:
> On Mon, May 07, 2018 at 05:01:33PM -0400, Johannes Weiner wrote:
> > +static inline unsigned long
> > +fixed_power_int(unsigned long x, unsigned int frac_bits, unsigned int n)
> > +{
> > + unsigned long result = 1UL << frac_bits;
> > +
> > + if (n) {
> > + for (;;) {
> > + if (n & 1) {
> > + result *= x;
> > + result += 1UL << (frac_bits - 1);
> > + result >>= frac_bits;
> > + }
> > + n >>= 1;
> > + if (!n)
> > + break;
> > + x *= x;
> > + x += 1UL << (frac_bits - 1);
> > + x >>= frac_bits;
> > + }
> > + }
> > +
> > + return result;
> > +}
>
> No real objection; but that does look a wee bit fat for an inline I
> suppose.

Fair enough, I'll put these back where I found them and make
calc_load_n() extern instead.

\
 
 \ /
  Last update: 2018-05-10 15:45    [W:0.050 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site