Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Yonghong Song <yhs@fb.com>
Cc: bpf <bpf@vger.kernel.org>,
Network Development <netdev@vger.kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Kernel Team <kernel-team@fb.com>,
"Paul E . McKenney" <paulmck@kernel.org>
Subject: Re: [PATCH bpf 1/2] bpf: fix a rcu_sched stall issue with bpf task/task_file iterator
Date: Tue, 18 Aug 2020 10:06:47 -0700 [thread overview]
Message-ID: <CAADnVQL-2PKh8rzVWjCWCSSO6WkdhS+azFUtcLmNT=1Wj1hH+A@mail.gmail.com> (raw)
In-Reply-To: <20200818162408.836816-1-yhs@fb.com>
On Tue, Aug 18, 2020 at 9:24 AM Yonghong Song <yhs@fb.com> wrote:
> index f21b5e1e4540..885b14cab2c0 100644
> --- a/kernel/bpf/task_iter.c
> +++ b/kernel/bpf/task_iter.c
> @@ -27,6 +27,8 @@ static struct task_struct *task_seq_get_next(struct pid_namespace *ns,
> struct task_struct *task = NULL;
> struct pid *pid;
>
> + cond_resched();
> +
> rcu_read_lock();
> retry:
> pid = idr_get_next(&ns->idr, tid);
> @@ -137,6 +139,8 @@ task_file_seq_get_next(struct bpf_iter_seq_task_file_info *info,
> struct task_struct *curr_task;
> int curr_fd = info->fd;
>
> + cond_resched();
> +
Instead of adding it to every *seq_get_next() it probably should be in
bpf_seq_read().
If cond_resched() is needed in task_file_seq_get_next() it should
probably be after 'again:'.
next prev parent reply other threads:[~2020-08-18 17:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-18 16:24 [PATCH bpf 0/2] bpf: two fixes for bpf task/task_file iterators Yonghong Song
2020-08-18 16:24 ` [PATCH bpf 1/2] bpf: fix a rcu_sched stall issue with bpf task/task_file iterator Yonghong Song
2020-08-18 16:48 ` Andrii Nakryiko
2020-08-18 17:07 ` Yonghong Song
2020-08-18 17:06 ` Alexei Starovoitov [this message]
2020-08-18 17:13 ` Yonghong Song
2020-08-18 16:24 ` [PATCH bpf 2/2] bpf: avoid visit same object multiple times Yonghong Song
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='CAADnVQL-2PKh8rzVWjCWCSSO6WkdhS+azFUtcLmNT=1Wj1hH+A@mail.gmail.com' \
--to=alexei.starovoitov@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=yhs@fb.com \
--subject='Re: [PATCH bpf 1/2] bpf: fix a rcu_sched stall issue with bpf task/task_file iterator' \
/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
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).