* [PATCH 1/1] libbpf: Delete an unneeded bool conversion @ 2021-05-10 12:43 Zhen Lei 2021-05-10 18:00 ` Andrii Nakryiko 0 siblings, 1 reply; 7+ messages in thread From: Zhen Lei @ 2021-05-10 12:43 UTC (permalink / raw) To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, netdev, bpf Cc: Zhen Lei The result of an expression consisting of a single relational operator is already of the bool type and does not need to be evaluated explicitly. No functional change. Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> --- tools/lib/bpf/libbpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index e2a3cf4378140f2..fa02213c451f4d2 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -1504,7 +1504,7 @@ static int set_kcfg_value_tri(struct extern_desc *ext, void *ext_val, ext->name, value); return -EINVAL; } - *(bool *)ext_val = value == 'y' ? true : false; + *(bool *)ext_val = value == 'y'; break; case KCFG_TRISTATE: if (value == 'y') -- 2.26.0.106.g9fadedd ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] libbpf: Delete an unneeded bool conversion 2021-05-10 12:43 [PATCH 1/1] libbpf: Delete an unneeded bool conversion Zhen Lei @ 2021-05-10 18:00 ` Andrii Nakryiko 2021-05-11 5:09 ` Leon Romanovsky 0 siblings, 1 reply; 7+ messages in thread From: Andrii Nakryiko @ 2021-05-10 18:00 UTC (permalink / raw) To: Zhen Lei Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, netdev, bpf On Mon, May 10, 2021 at 5:43 AM Zhen Lei <thunder.leizhen@huawei.com> wrote: > > The result of an expression consisting of a single relational operator is > already of the bool type and does not need to be evaluated explicitly. > > No functional change. > > Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> > --- See [0] and [1]. [0] https://lore.kernel.org/bpf/CAEf4BzYgLf5g3oztbA-CJR4gQ7AVKQAGrsHWCOgTtUMUM-Mxfg@mail.gmail.com/ [1] https://lore.kernel.org/bpf/CAEf4BzZQ6=-h3g1duXFwDLr92z7nE6ajv8Rz_Zv=qx=-F3sRVA@mail.gmail.com/ > tools/lib/bpf/libbpf.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c > index e2a3cf4378140f2..fa02213c451f4d2 100644 > --- a/tools/lib/bpf/libbpf.c > +++ b/tools/lib/bpf/libbpf.c > @@ -1504,7 +1504,7 @@ static int set_kcfg_value_tri(struct extern_desc *ext, void *ext_val, > ext->name, value); > return -EINVAL; > } > - *(bool *)ext_val = value == 'y' ? true : false; > + *(bool *)ext_val = value == 'y'; > break; > case KCFG_TRISTATE: > if (value == 'y') > -- > 2.26.0.106.g9fadedd > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] libbpf: Delete an unneeded bool conversion 2021-05-10 18:00 ` Andrii Nakryiko @ 2021-05-11 5:09 ` Leon Romanovsky 2021-05-12 19:02 ` Andrii Nakryiko 0 siblings, 1 reply; 7+ messages in thread From: Leon Romanovsky @ 2021-05-11 5:09 UTC (permalink / raw) To: Andrii Nakryiko Cc: Zhen Lei, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, netdev, bpf On Mon, May 10, 2021 at 11:00:29AM -0700, Andrii Nakryiko wrote: > On Mon, May 10, 2021 at 5:43 AM Zhen Lei <thunder.leizhen@huawei.com> wrote: > > > > The result of an expression consisting of a single relational operator is > > already of the bool type and does not need to be evaluated explicitly. > > > > No functional change. > > > > Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> > > --- > > See [0] and [1]. > > [0] https://lore.kernel.org/bpf/CAEf4BzYgLf5g3oztbA-CJR4gQ7AVKQAGrsHWCOgTtUMUM-Mxfg@mail.gmail.com/ > [1] https://lore.kernel.org/bpf/CAEf4BzZQ6=-h3g1duXFwDLr92z7nE6ajv8Rz_Zv=qx=-F3sRVA@mail.gmail.com/ How long do you plan to fight with such patches? Thanks > > > tools/lib/bpf/libbpf.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c > > index e2a3cf4378140f2..fa02213c451f4d2 100644 > > --- a/tools/lib/bpf/libbpf.c > > +++ b/tools/lib/bpf/libbpf.c > > @@ -1504,7 +1504,7 @@ static int set_kcfg_value_tri(struct extern_desc *ext, void *ext_val, > > ext->name, value); > > return -EINVAL; > > } > > - *(bool *)ext_val = value == 'y' ? true : false; > > + *(bool *)ext_val = value == 'y'; > > break; > > case KCFG_TRISTATE: > > if (value == 'y') > > -- > > 2.26.0.106.g9fadedd > > > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] libbpf: Delete an unneeded bool conversion 2021-05-11 5:09 ` Leon Romanovsky @ 2021-05-12 19:02 ` Andrii Nakryiko 2021-05-13 2:14 ` Leizhen (ThunderTown) 2021-05-13 6:31 ` Leon Romanovsky 0 siblings, 2 replies; 7+ messages in thread From: Andrii Nakryiko @ 2021-05-12 19:02 UTC (permalink / raw) To: Leon Romanovsky Cc: Zhen Lei, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, netdev, bpf On Mon, May 10, 2021 at 10:09 PM Leon Romanovsky <leon@kernel.org> wrote: > > On Mon, May 10, 2021 at 11:00:29AM -0700, Andrii Nakryiko wrote: > > On Mon, May 10, 2021 at 5:43 AM Zhen Lei <thunder.leizhen@huawei.com> wrote: > > > > > > The result of an expression consisting of a single relational operator is > > > already of the bool type and does not need to be evaluated explicitly. > > > > > > No functional change. > > > > > > Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> > > > --- > > > > See [0] and [1]. > > > > [0] https://lore.kernel.org/bpf/CAEf4BzYgLf5g3oztbA-CJR4gQ7AVKQAGrsHWCOgTtUMUM-Mxfg@mail.gmail.com/ > > [1] https://lore.kernel.org/bpf/CAEf4BzZQ6=-h3g1duXFwDLr92z7nE6ajv8Rz_Zv=qx=-F3sRVA@mail.gmail.com/ > > How long do you plan to fight with such patches? As long as necessary. There are better ways to contribute to libbpf than doing cosmetic changes to the perfectly correct code. > > Thanks > > > > > > tools/lib/bpf/libbpf.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c > > > index e2a3cf4378140f2..fa02213c451f4d2 100644 > > > --- a/tools/lib/bpf/libbpf.c > > > +++ b/tools/lib/bpf/libbpf.c > > > @@ -1504,7 +1504,7 @@ static int set_kcfg_value_tri(struct extern_desc *ext, void *ext_val, > > > ext->name, value); > > > return -EINVAL; > > > } > > > - *(bool *)ext_val = value == 'y' ? true : false; > > > + *(bool *)ext_val = value == 'y'; > > > break; > > > case KCFG_TRISTATE: > > > if (value == 'y') > > > -- > > > 2.26.0.106.g9fadedd > > > > > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] libbpf: Delete an unneeded bool conversion 2021-05-12 19:02 ` Andrii Nakryiko @ 2021-05-13 2:14 ` Leizhen (ThunderTown) 2021-05-13 6:22 ` Leon Romanovsky 2021-05-13 6:31 ` Leon Romanovsky 1 sibling, 1 reply; 7+ messages in thread From: Leizhen (ThunderTown) @ 2021-05-13 2:14 UTC (permalink / raw) To: Andrii Nakryiko, Leon Romanovsky Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, netdev, bpf On 2021/5/13 3:02, Andrii Nakryiko wrote: > On Mon, May 10, 2021 at 10:09 PM Leon Romanovsky <leon@kernel.org> wrote: >> >> On Mon, May 10, 2021 at 11:00:29AM -0700, Andrii Nakryiko wrote: >>> On Mon, May 10, 2021 at 5:43 AM Zhen Lei <thunder.leizhen@huawei.com> wrote: >>>> >>>> The result of an expression consisting of a single relational operator is >>>> already of the bool type and does not need to be evaluated explicitly. >>>> >>>> No functional change. >>>> >>>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> >>>> --- >>> >>> See [0] and [1]. >>> >>> [0] https://lore.kernel.org/bpf/CAEf4BzYgLf5g3oztbA-CJR4gQ7AVKQAGrsHWCOgTtUMUM-Mxfg@mail.gmail.com/ >>> [1] https://lore.kernel.org/bpf/CAEf4BzZQ6=-h3g1duXFwDLr92z7nE6ajv8Rz_Zv=qx=-F3sRVA@mail.gmail.com/ >> >> How long do you plan to fight with such patches? > > As long as necessary. There are better ways to contribute to libbpf > than doing cosmetic changes to the perfectly correct code. No small stream, no river and sea. There are no improvements to functionality, but may slightly speed up compilation. With more such accumulations, it is possible that the compilation of allmodconfig results in a second-level improvement. I don't know if you agree, at least I think so. > >> >> Thanks >> >>> >>>> tools/lib/bpf/libbpf.c | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c >>>> index e2a3cf4378140f2..fa02213c451f4d2 100644 >>>> --- a/tools/lib/bpf/libbpf.c >>>> +++ b/tools/lib/bpf/libbpf.c >>>> @@ -1504,7 +1504,7 @@ static int set_kcfg_value_tri(struct extern_desc *ext, void *ext_val, >>>> ext->name, value); >>>> return -EINVAL; >>>> } >>>> - *(bool *)ext_val = value == 'y' ? true : false; >>>> + *(bool *)ext_val = value == 'y'; >>>> break; >>>> case KCFG_TRISTATE: >>>> if (value == 'y') >>>> -- >>>> 2.26.0.106.g9fadedd >>>> >>>> > > . > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] libbpf: Delete an unneeded bool conversion 2021-05-13 2:14 ` Leizhen (ThunderTown) @ 2021-05-13 6:22 ` Leon Romanovsky 0 siblings, 0 replies; 7+ messages in thread From: Leon Romanovsky @ 2021-05-13 6:22 UTC (permalink / raw) To: Leizhen (ThunderTown) Cc: Andrii Nakryiko, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, netdev, bpf On Thu, May 13, 2021 at 10:14:00AM +0800, Leizhen (ThunderTown) wrote: > > > On 2021/5/13 3:02, Andrii Nakryiko wrote: > > On Mon, May 10, 2021 at 10:09 PM Leon Romanovsky <leon@kernel.org> wrote: > >> > >> On Mon, May 10, 2021 at 11:00:29AM -0700, Andrii Nakryiko wrote: > >>> On Mon, May 10, 2021 at 5:43 AM Zhen Lei <thunder.leizhen@huawei.com> wrote: > >>>> > >>>> The result of an expression consisting of a single relational operator is > >>>> already of the bool type and does not need to be evaluated explicitly. > >>>> > >>>> No functional change. > >>>> > >>>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> > >>>> --- > >>> > >>> See [0] and [1]. > >>> > >>> [0] https://lore.kernel.org/bpf/CAEf4BzYgLf5g3oztbA-CJR4gQ7AVKQAGrsHWCOgTtUMUM-Mxfg@mail.gmail.com/ > >>> [1] https://lore.kernel.org/bpf/CAEf4BzZQ6=-h3g1duXFwDLr92z7nE6ajv8Rz_Zv=qx=-F3sRVA@mail.gmail.com/ > >> > >> How long do you plan to fight with such patches? > > > > As long as necessary. There are better ways to contribute to libbpf > > than doing cosmetic changes to the perfectly correct code. > > No small stream, no river and sea. > > There are no improvements to functionality, but may slightly speed up compilation. > With more such accumulations, it is possible that the compilation of allmodconfig > results in a second-level improvement. Unlikely with modern CPUs. > > I don't know if you agree, at least I think so. > > > > >> > >> Thanks > >> > >>> > >>>> tools/lib/bpf/libbpf.c | 2 +- > >>>> 1 file changed, 1 insertion(+), 1 deletion(-) > >>>> > >>>> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c > >>>> index e2a3cf4378140f2..fa02213c451f4d2 100644 > >>>> --- a/tools/lib/bpf/libbpf.c > >>>> +++ b/tools/lib/bpf/libbpf.c > >>>> @@ -1504,7 +1504,7 @@ static int set_kcfg_value_tri(struct extern_desc *ext, void *ext_val, > >>>> ext->name, value); > >>>> return -EINVAL; > >>>> } > >>>> - *(bool *)ext_val = value == 'y' ? true : false; > >>>> + *(bool *)ext_val = value == 'y'; > >>>> break; > >>>> case KCFG_TRISTATE: > >>>> if (value == 'y') > >>>> -- > >>>> 2.26.0.106.g9fadedd > >>>> > >>>> > > > > . > > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/1] libbpf: Delete an unneeded bool conversion 2021-05-12 19:02 ` Andrii Nakryiko 2021-05-13 2:14 ` Leizhen (ThunderTown) @ 2021-05-13 6:31 ` Leon Romanovsky 1 sibling, 0 replies; 7+ messages in thread From: Leon Romanovsky @ 2021-05-13 6:31 UTC (permalink / raw) To: Andrii Nakryiko Cc: Zhen Lei, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, netdev, bpf On Wed, May 12, 2021 at 12:02:11PM -0700, Andrii Nakryiko wrote: > On Mon, May 10, 2021 at 10:09 PM Leon Romanovsky <leon@kernel.org> wrote: > > > > On Mon, May 10, 2021 at 11:00:29AM -0700, Andrii Nakryiko wrote: > > > On Mon, May 10, 2021 at 5:43 AM Zhen Lei <thunder.leizhen@huawei.com> wrote: > > > > > > > > The result of an expression consisting of a single relational operator is > > > > already of the bool type and does not need to be evaluated explicitly. > > > > > > > > No functional change. > > > > > > > > Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> > > > > --- > > > > > > See [0] and [1]. > > > > > > [0] https://lore.kernel.org/bpf/CAEf4BzYgLf5g3oztbA-CJR4gQ7AVKQAGrsHWCOgTtUMUM-Mxfg@mail.gmail.com/ > > > [1] https://lore.kernel.org/bpf/CAEf4BzZQ6=-h3g1duXFwDLr92z7nE6ajv8Rz_Zv=qx=-F3sRVA@mail.gmail.com/ > > > > How long do you plan to fight with such patches? > > As long as necessary. There are better ways to contribute to libbpf > than doing cosmetic changes to the perfectly correct code. I wish you good luck with that. My hope that, you have enough spare time to invest in rejects. Thanks ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-05-13 6:31 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-05-10 12:43 [PATCH 1/1] libbpf: Delete an unneeded bool conversion Zhen Lei 2021-05-10 18:00 ` Andrii Nakryiko 2021-05-11 5:09 ` Leon Romanovsky 2021-05-12 19:02 ` Andrii Nakryiko 2021-05-13 2:14 ` Leizhen (ThunderTown) 2021-05-13 6:22 ` Leon Romanovsky 2021-05-13 6:31 ` Leon Romanovsky
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).