[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAADnVQL-2PKh8rzVWjCWCSSO6WkdhS+azFUtcLmNT=1Wj1hH+A@mail.gmail.com>
Date: Tue, 18 Aug 2020 10:06:47 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Yonghong Song <yhs@...com>
Cc: bpf <bpf@...r.kernel.org>,
Network Development <netdev@...r.kernel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Kernel Team <kernel-team@...com>,
"Paul E . McKenney" <paulmck@...nel.org>
Subject: Re: [PATCH bpf 1/2] bpf: fix a rcu_sched stall issue with bpf
task/task_file iterator
On Tue, Aug 18, 2020 at 9:24 AM Yonghong Song <yhs@...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:'.
Powered by blists - more mailing lists