On 01.09.2019 20:24, Pavel Machek wrote:
> Hi!
>
>>> This patch adds coccinelle script for detecting !likely and !unlikely
>>> usage. It's better to use unlikely instead of !likely and vice versa.
>>
>> Please explain _why_ is it better in the changelog.
>>
>> btw: there are relatively few
Hi!
> > This patch adds coccinelle script for detecting !likely and !unlikely
> > usage. It's better to use unlikely instead of !likely and vice versa.
>
> Please explain _why_ is it better in the changelog.
>
> btw: there are relatively few uses like this in the kernel.
>
> $ git grep -P
On 8/28/19 3:41 PM, Denis Efremov wrote:
>
>>
>> As a human I am confused. Is !likely(x) equivalent to x or !x?
>>
>> Julia
>>
>
> As far as I could understand it:
>
> # define likely(x)__builtin_expect(!!(x), 1)
> !likely(x)
> !__builtin_expect(!!(x), 1)
> !((!!(x)) == 1)
> (!!(x)) != 1,
>
> As a human I am confused. Is !likely(x) equivalent to x or !x?
>
> Julia
>
As far as I could understand it:
# define likely(x) __builtin_expect(!!(x), 1)
!likely(x)
!__builtin_expect(!!(x), 1)
!((!!(x)) == 1)
(!!(x)) != 1, since !! could result in 0 or 1
(!!(x)) == 0
!(!!(x))
On 8/28/19 2:33 PM, Rasmus Villemoes wrote:
> On 25/08/2019 21.19, Julia Lawall wrote:
>>
>>
>>> On 26 Aug 2019, at 02:59, Denis Efremov wrote:
>>>
>>>
>>>
On 25.08.2019 19:37, Joe Perches wrote:
> On Sun, 2019-08-25 at 16:05 +0300, Denis Efremov wrote:
> This patch adds coccinelle
On Wed, 28 Aug 2019, Rasmus Villemoes wrote:
> On 25/08/2019 21.19, Julia Lawall wrote:
> >
> >
> >> On 26 Aug 2019, at 02:59, Denis Efremov wrote:
> >>
> >>
> >>
> >>> On 25.08.2019 19:37, Joe Perches wrote:
> On Sun, 2019-08-25 at 16:05 +0300, Denis Efremov wrote:
> This patch
On Wed, 2019-08-28 at 13:33 +0200, Rasmus Villemoes wrote:
> On 25/08/2019 21.19, Julia Lawall wrote:
> > > On 26 Aug 2019, at 02:59, Denis Efremov wrote:
> > > > On 25.08.2019 19:37, Joe Perches wrote:
> > > > > On Sun, 2019-08-25 at 16:05 +0300, Denis Efremov wrote:
> > > > > This patch adds
On 25/08/2019 21.19, Julia Lawall wrote:
>
>
>> On 26 Aug 2019, at 02:59, Denis Efremov wrote:
>>
>>
>>
>>> On 25.08.2019 19:37, Joe Perches wrote:
On Sun, 2019-08-25 at 16:05 +0300, Denis Efremov wrote:
This patch adds coccinelle script for detecting !likely and !unlikely
usage.
> I think it's incorrect to say so in general. For example, on x86/64:
>
> $ make mrproper
> $ make allyesconfig
> $ make && mv vmlinux vmlinux-000
> $ make coccicheck MODE=patch COCCI=scripts/coccinelle/misc/unlikely.cocci |
> patch -p1
> $ make
> $ ./scripts/bloat-o-meter ./vmlinux-000
On 25.08.2019 18:30, Markus Elfring wrote:
>> +(
>> +* !likely(E)
>> +|
>> +* !unlikely(E)
>> +)
>
> Can the following code variant be nicer?
>
> +*! \( likely \| unlikely \) (E)
>
>
>> +(
>> +-!likely(E)
>> ++unlikely(E)
>> +|
>> +-!unlikely(E)
>> ++likely(E)
>> +)
>
> I would find the
> On 26 Aug 2019, at 02:59, Denis Efremov wrote:
>
>
>
>> On 25.08.2019 19:37, Joe Perches wrote:
>>> On Sun, 2019-08-25 at 16:05 +0300, Denis Efremov wrote:
>>> This patch adds coccinelle script for detecting !likely and !unlikely
>>> usage. It's better to use unlikely instead of !likely
On 25.08.2019 19:37, Joe Perches wrote:
> On Sun, 2019-08-25 at 16:05 +0300, Denis Efremov wrote:
>> This patch adds coccinelle script for detecting !likely and !unlikely
>> usage. It's better to use unlikely instead of !likely and vice versa.
>
> Please explain _why_ is it better in the
On Sun, 2019-08-25 at 16:05 +0300, Denis Efremov wrote:
> This patch adds coccinelle script for detecting !likely and !unlikely
> usage. It's better to use unlikely instead of !likely and vice versa.
Please explain _why_ is it better in the changelog.
btw: there are relatively few uses like this
> +(
> +* !likely(E)
> +|
> +* !unlikely(E)
> +)
Can the following code variant be nicer?
+*! \( likely \| unlikely \) (E)
> +(
> +-!likely(E)
> ++unlikely(E)
> +|
> +-!unlikely(E)
> ++likely(E)
> +)
I would find the following SmPL change specification more succinct.
+(
+-!likely
++unlikely
> +(
> +* !likely(E)
> +|
> +* !unlikely(E)
> +)
Can the following code variant be nicer?
+*! \( likely \| unlikely \) (E)
> +(
> +-!likely(E)
> ++unlikely(E)
> +|
> +-!unlikely(E)
> ++likely(E)
> +)
I would find the following SmPL change specification more succinct.
+(
+-!likely
++unlikely
This patch adds coccinelle script for detecting !likely and !unlikely
usage. It's better to use unlikely instead of !likely and vice versa.
Signed-off-by: Denis Efremov
---
scripts/coccinelle/misc/unlikely.cocci | 70 ++
1 file changed, 70 insertions(+)
create mode
16 matches
Mail list logo