Re: [PATCH] lib/string.c: Disable tree-loop-distribute-patterns

From: Arvind Sankar
Date: Wed Aug 19 2020 - 09:24:59 EST


On Tue, Aug 18, 2020 at 08:32:58PM -0700, Linus Torvalds wrote:
> On Tue, Aug 18, 2020 at 8:04 PM Arvind Sankar <nivedita@xxxxxxxxxxxx> wrote:
>
> > Might be worth optimizing strnlen etc with the word-at-a-time thing though.
>
> Yeah, possibly. Except the kernel almost never uses strnlen for
> anything bigger. At least I haven't seen it very much in the profiles.

strscpy could be implemented as strnlen+memcpy. I'd think that wouldn't
be much slower, especially if strnlen is optimized and the arch has a
good implementation of memcpy?