[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VfH9M=h7UZPrWLwSmUXXPJFrO+zwAbf_g1k2_HPBM4HKw@mail.gmail.com>
Date: Mon, 11 Jul 2022 17:03:09 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Andrey Semashev <andrey.semashev@...il.com>
Cc: Yu-Jen Chang <arthurchang09@...il.com>,
Andy Shevchenko <andy@...nel.org>,
Akinobu Mita <akinobu.mita@...il.com>,
Ching-Chun Huang <jserv@...s.ncku.edu.tw>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] lib/string.c: Optimize memchr()
On Mon, Jul 11, 2022 at 5:00 PM Andrey Semashev
<andrey.semashev@...il.com> wrote:
> On 7/11/22 17:52, Yu-Jen Chang wrote:
...
> I think you're missing the point. Loads at unaligned addresses may not
> be allowed by hardware using conventional load instructions or may be
> inefficient. Given that this memchr implementation is used as a fallback
> when no hardware-specific version is available, you should be
> conservative wrt. hardware capabilities and behavior. You should
> probably have a pre-alignment loop.
Exactly!
The initial code is broken, NAK.
P.S. At least you may look into strscpy() implementation to get a clue.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists