[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a9106c37-51d3-be8e-c9c2-4ca279b4523e@gmail.com>
Date: Wed, 13 Jul 2022 12:57:52 +0300
From: Andrey Semashev <andrey.semashev@...il.com>
To: David Laight <David.Laight@...LAB.COM>,
'Yu-Jen Chang' <arthurchang09@...il.com>
Cc: "andy@...nel.org" <andy@...nel.org>,
"akinobu.mita@...il.com" <akinobu.mita@...il.com>,
Ching-Chun Huang <jserv@...s.ncku.edu.tw>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] lib/string.c: Optimize memchr()
On 7/13/22 12:39, David Laight wrote:
> From: Yu-Jen Chang
>> Sent: 12 July 2022 15:59
> ...
>>> 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.
>>
>> Got it. I add pre-alignment loop. It aligns the address to 8 or 4bytes.
>
> That should be predicated on !HAS_EFFICIENT_UNALIGNED_ACCESS.
If there is a pre-alignment loop, there won't be unaligned loads, so
there shouldn't be the need for the HAS_EFFICIENT_UNALIGNED_ACCESS
check. Unless I misunderstand what HAS_EFFICIENT_UNALIGNED_ACCESS indicates.
Powered by blists - more mailing lists