Re: [GIT PULL] s390 updates for 5.15-rc6

From: Linus Torvalds
Date: Sat Oct 16 2021 - 12:22:35 EST


On Sat, Oct 16, 2021 at 2:26 AM Vasily Gorbik <gor@xxxxxxxxxxxxx> wrote:
>
> - Fix broken strrchr implementation.

I pulled this, but had to look at this commit just because it struck me as odd.

Is the generic strrchr() implementation so bad for s390 that it shows
up? It looks like the s390 implementation wants to avoid checking
separately against the final NUL character and basically uses the
optimized strlen function to do so, but when strrchr has to walk the
string _anyway_ this all looks a bit odd.

Not a big deal. I just get the feeling that s390 (and probably other
architectures) might be a bit too eager to make their own helper
string functions for reasons that may be historical ("we didn't have
generic string functions at all long ago") or misguided ("we'll do an
architecture-optimized version even for things that don't matter").

Linus