Re: [Cocci] [PATCH] scripts: coccinelle: check for !(un)?likely usage

2019-09-01 Thread Denis Efremov
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

Re: [PATCH] scripts: coccinelle: check for !(un)?likely usage

2019-09-01 Thread Pavel Machek
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

Re: [Cocci] [PATCH] scripts: coccinelle: check for !(un)?likely usage

2019-08-28 Thread Denis Efremov
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,

Re: [PATCH] scripts: coccinelle: check for !(un)?likely usage

2019-08-28 Thread Denis Efremov
> > 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))

Re: [PATCH] scripts: coccinelle: check for !(un)?likely usage

2019-08-28 Thread Denis Efremov
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

Re: [PATCH] scripts: coccinelle: check for !(un)?likely usage

2019-08-28 Thread Julia Lawall
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

Re: [PATCH] scripts: coccinelle: check for !(un)?likely usage

2019-08-28 Thread Joe Perches
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

Re: [PATCH] scripts: coccinelle: check for !(un)?likely usage

2019-08-28 Thread Rasmus Villemoes
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.

Re: [Cocci] [PATCH] scripts: coccinelle: check for !(un)?likely usage

2019-08-25 Thread Denis Efremov
> 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

Re: [PATCH] scripts: coccinelle: check for !(un)?likely usage

2019-08-25 Thread Denis Efremov
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

Re: [Cocci] [PATCH] scripts: coccinelle: check for !(un)?likely usage

2019-08-25 Thread Julia Lawall
> 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

Re: [PATCH] scripts: coccinelle: check for !(un)?likely usage

2019-08-25 Thread Denis Efremov
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

Re: [PATCH] scripts: coccinelle: check for !(un)?likely usage

2019-08-25 Thread Joe Perches
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

Re: [PATCH] scripts: coccinelle: check for !(un)?likely usage

2019-08-25 Thread Markus Elfring
> +( > +* !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

Re: [PATCH] scripts: coccinelle: check for !(un)?likely usage

2019-08-25 Thread Markus Elfring
> +( > +* !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

[PATCH] scripts: coccinelle: check for !(un)?likely usage

2019-08-25 Thread Denis Efremov
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