From: Alexei Starovoitov <ast@fb.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>,
Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Daniel Borkmann <daniel@iogearbox.net>, bpf <bpf@vger.kernel.org>,
Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH v2 bpf-next 3/7] bpf: Add per-program recursion prevention mechanism
Date: Tue, 9 Feb 2021 11:06:10 -0800 [thread overview]
Message-ID: <6757a479-cb35-ac3d-9978-71f1c4daf4a9@fb.com> (raw)
In-Reply-To: <CAEf4Bzb1D9AzOU2Zn2DkZrP+VYOPuJ-7xFcEF1unTr6SutMSWg@mail.gmail.com>
On 2/8/21 12:51 PM, Andrii Nakryiko wrote:
>> start = sched_clock();
>> + if (unlikely(!start))
>> + start = NO_START_TIME;
>> + }
>> return start;
>
>
> Oh, and actually, given you have `start > NO_START_TIME` condition in
> exit function, you don't need this `if (unlikely(!start))` bit at all,
> because you are going to ignore both 0 and 1. So maybe no need for a
> new function, but no need for extra if as well.
This unlikely(!start) is needed for very unlikely case when
sched_clock() returns 0. In such case the prog should still be executed.
next prev parent reply other threads:[~2021-02-09 19:18 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-06 17:03 [PATCH v2 bpf-next 0/7] bpf: Misc improvements Alexei Starovoitov
2021-02-06 17:03 ` [PATCH v2 bpf-next 1/7] bpf: Optimize program stats Alexei Starovoitov
2021-02-08 18:57 ` Andrii Nakryiko
2021-02-08 21:28 ` Daniel Borkmann
2021-02-08 23:13 ` Alexei Starovoitov
2021-02-09 0:53 ` Daniel Borkmann
2021-02-06 17:03 ` [PATCH v2 bpf-next 2/7] bpf: Compute program stats for sleepable programs Alexei Starovoitov
2021-02-08 20:35 ` Andrii Nakryiko
2021-02-06 17:03 ` [PATCH v2 bpf-next 3/7] bpf: Add per-program recursion prevention mechanism Alexei Starovoitov
2021-02-08 20:51 ` Andrii Nakryiko
2021-02-09 19:06 ` Alexei Starovoitov [this message]
2021-02-09 19:15 ` Andrii Nakryiko
2021-02-06 17:03 ` [PATCH v2 bpf-next 4/7] selftest/bpf: Add a recursion test Alexei Starovoitov
2021-02-08 20:54 ` Andrii Nakryiko
2021-02-06 17:03 ` [PATCH v2 bpf-next 5/7] bpf: Count the number of times recursion was prevented Alexei Starovoitov
2021-02-08 20:58 ` Andrii Nakryiko
2021-02-06 17:03 ` [PATCH v2 bpf-next 6/7] bpf: Allows per-cpu maps and map-in-map in sleepable programs Alexei Starovoitov
2021-02-08 21:00 ` Andrii Nakryiko
2021-02-08 21:01 ` Andrii Nakryiko
2021-02-08 23:20 ` Alexei Starovoitov
2021-02-06 17:03 ` [PATCH v2 bpf-next 7/7] selftests/bpf: Add a test for map-in-map and per-cpu maps in sleepable progs Alexei Starovoitov
2021-02-08 21:04 ` Andrii Nakryiko
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=6757a479-cb35-ac3d-9978-71f1c4daf4a9@fb.com \
--to=ast@fb.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii.nakryiko@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=kernel-team@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