Re: [PATCH v2] sched/cputime: make scale_stime() more precise

From: Linus Torvalds
Date: Tue May 19 2020 - 15:51:56 EST


On Tue, May 19, 2020 at 12:12 PM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> My compiler doesn't like overriding a __weak with a static inline. It
> complains about redefinitions.
>
> It works with extern inline though; but that is fairly rare in the
> kernel. Still it compiles and generates the right code.

That's a tiny bit worrisome, because the compiler might just decide
not to inline at all and then you end up with the (relatively bad)
version that doesn't take advantage of the hardware capabilities. But
things will work, and not be absolutely horrid, I guess.

And you do use "always_inline" so I guess it's all fine.

For added protection, you might also mark the asm itself as
"asm_inline", which makes sure gcc thinks it's a small asm too.

Regardless, ack from me, with just a note on that small worry.

Linus