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]
Message-ID: <2924b09c-bf19-4de2-aae4-55752dab24a6@intel.com>
Date:   Wed, 11 Oct 2023 09:25:50 +0200
From:   Alexander Lobakin <aleksander.lobakin@...el.com>
To:     Yury Norov <yury.norov@...il.com>
CC:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Alexander Potapenko <glider@...gle.com>,
        "Jakub Kicinski" <kuba@...nel.org>,
        Eric Dumazet <edumazet@...gle.com>,
        David Ahern <dsahern@...nel.org>,
        Przemek Kitszel <przemyslaw.kitszel@...el.com>,
        "Simon Horman" <simon.horman@...igine.com>,
        <netdev@...r.kernel.org>, <linux-btrfs@...r.kernel.org>,
        <dm-devel@...hat.com>, <ntfs3@...ts.linux.dev>,
        <linux-s390@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 03/14] bitops: let the compiler optimize __assign_bit()

From: Yury Norov <yury.norov@...il.com>
Date: Mon, 9 Oct 2023 09:18:40 -0700

> On Mon, Oct 09, 2023 at 05:10:15PM +0200, Alexander Lobakin wrote:

[...]

>> -static __always_inline void __assign_bit(long nr, volatile unsigned long *addr,
>> -					 bool value)
>> -{
>> -	if (value)
>> -		__set_bit(nr, addr);
>> -	else
>> -		__clear_bit(nr, addr);
>> -}
>> +#define __assign_bit(nr, addr, value)				\
>> +	((value) ? __set_bit(nr, addr) : __clear_bit(nr, addr))
> 
> Can you protect nr and addr with braces just as well?
> Can you convert the atomic version too, to keep them synchronized ?

+ for both. I didn't convert assign_bit() as I thought it wouldn't give
any optimization improvements, but yeah, let the compiler decide.

> 
>>  
>>  /**
>>   * __ptr_set_bit - Set bit in a pointer's value
>> -- 
>> 2.41.0

Thanks,
Olek

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ