lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 1 Feb 2012 22:11:11 +0900
From:	Akinobu Mita <akinobu.mita@...il.com>
To:	Brian Norris <computersforpeace@...il.com>
Cc:	Joe Perches <joe@...ches.com>,
	Scott Branden <sbranden@...adcom.com>,
	linux-kernel@...r.kernel.org, linux-mtd@...ts.infradead.org,
	Jiandong Zheng <jdzheng@...adcom.com>,
	akpm@...ux-foundation.org, David Woodhouse <dwmw2@...radead.org>,
	eric.dumazet@...il.com
Subject: Re: [PATCH] mtd/nand: use string library

2012/2/1 Brian Norris <computersforpeace@...il.com>:
> On Fri, Jan 27, 2012 at 3:52 PM, Akinobu Mita <akinobu.mita@...il.com> wrote:
>> 2012/1/28 Brian Norris <computersforpeace@...il.com>:
>>> On Fri, Jan 27, 2012 at 9:16 AM, Joe Perches <joe@...ches.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.
>
> Well, I agree that it qualifies as cleanup as well, but we should at
> least make an attempt not to cause performance regression...
>
> So by my understanding, the use of memchr_inv() is on buffers of
> minimum length of 10 in this patch, so we're likely to have decent
> results. And memcmp() usage looks fine to me.

Sorry, I answered without checking memchr_inv() carefully.  If the size
of buffer is less than 16 bytes, memchr_inv() scans for each byte as the
original code did.  So it is unlikely to be slower in the most cases.

But I mentioned in the previous email, there are some problems in
memchr_inv().  I'll send the patch in a few days.

> So unless other concerns arise:
>
> Acked-by: Brian Norris <computersforpeace@...il.com>

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ