netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: "Leizhen (ThunderTown)" <thunder.leizhen@huawei.com>
Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>, netdev <netdev@vger.kernel.org>,
	bpf <bpf@vger.kernel.org>
Subject: Re: [PATCH 1/1] libbpf: Delete an unneeded bool conversion
Date: Thu, 13 May 2021 09:22:56 +0300	[thread overview]
Message-ID: <YJzFwKCRoFibZdWD@unreal> (raw)
In-Reply-To: <f82343ec-9d67-d033-dd07-813e7d981c4f@huawei.com>

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
> >>>>
> >>>>
> > 
> > .
> > 
> 

  reply	other threads:[~2021-05-13  6:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2021-05-13  6:31       ` Leon Romanovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YJzFwKCRoFibZdWD@unreal \
    --to=leon@kernel.org \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=thunder.leizhen@huawei.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).