[PATCH] mtd/nand: use string library

Akinobu Mita akinobu.mita at gmail.com
Fri Jan 27 18:52:25 EST 2012


2012/1/28 Brian Norris <computersforpeace at gmail.com>:
> On Fri, Jan 27, 2012 at 9:16 AM, Joe Perches <joe at perches.com> wrote:
>> On Fri, 2012-01-27 at 23:24 +0900, Akinobu Mita wrote:
>>> - Use memchr_inv to check if the data contains all 0xFF bytes.
>>>   It is faster than looping for each byte.
>>
>> Stupid question:
>>
>> Are there any mtd devices modified that are slower
>> at 64 bit accesses than repeated 8 bit accesses?
>
> I believe this patch deals with kernel buffers, not any kind of direct
> access to the MTD, so the question (which is not stupid IMO) should be
> regarding CPU architectures. And my educated guess is that 64-bit
> access should not be any slower. I do know that 8-bit access *is*
> slower for some relevant architectures.

It could be slower when the number of bytes scanned is very small
(found a unmatched character immediately, or the size of the area
is very small), because memchr_inv() needs to generate a 64bit pattern
to compare before starting the loop.  I recalled that Eric Dumazet
pointed out it could generate the 64bit pattern more efficiently.
(https://lkml.org/lkml/2011/8/8/480)

Even if that small scanning is slower, this change can be assumed cleanup
patch that simplifies the code.



More information about the linux-mtd mailing list