* Re: [PATCH bpf-next] bpf: remove unnecessary loop in task_file_seq_get_next()
2024-07-04 15:19 [PATCH bpf-next] bpf: remove unnecessary loop in task_file_seq_get_next() Dan Carpenter
@ 2024-07-04 21:55 ` Jiri Olsa
2024-07-06 9:02 ` Christian Brauner
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Jiri Olsa @ 2024-07-04 21:55 UTC (permalink / raw)
To: Dan Carpenter
Cc: Yonghong Song, Christian Brauner, Alexei Starovoitov,
Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau,
Eduard Zingerman, Song Liu, John Fastabend, KP Singh,
Stanislav Fomichev, Hao Luo, bpf, linux-kernel, kernel-janitors
On Thu, Jul 04, 2024 at 10:19:19AM -0500, Dan Carpenter wrote:
> After commit 0ede61d8589c ("file: convert to SLAB_TYPESAFE_BY_RCU") this
> loop always iterates exactly one time. Delete the for statement and pull
> the code in a tab.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
lgtm
Acked-by: Jiri Olsa <jolsa@kernel.org>
jirka
> ---
> kernel/bpf/task_iter.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/kernel/bpf/task_iter.c b/kernel/bpf/task_iter.c
> index ec4e97c61eef..02aa9db8d796 100644
> --- a/kernel/bpf/task_iter.c
> +++ b/kernel/bpf/task_iter.c
> @@ -261,6 +261,7 @@ task_file_seq_get_next(struct bpf_iter_seq_task_file_info *info)
> u32 saved_tid = info->tid;
> struct task_struct *curr_task;
> unsigned int curr_fd = info->fd;
> + struct file *f;
>
> /* If this function returns a non-NULL file object,
> * it held a reference to the task/file.
> @@ -286,12 +287,8 @@ task_file_seq_get_next(struct bpf_iter_seq_task_file_info *info)
> }
>
> rcu_read_lock();
> - for (;; curr_fd++) {
> - struct file *f;
> - f = task_lookup_next_fdget_rcu(curr_task, &curr_fd);
> - if (!f)
> - break;
> -
> + f = task_lookup_next_fdget_rcu(curr_task, &curr_fd);
> + if (f) {
> /* set info->fd */
> info->fd = curr_fd;
> rcu_read_unlock();
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH bpf-next] bpf: remove unnecessary loop in task_file_seq_get_next()
2024-07-04 15:19 [PATCH bpf-next] bpf: remove unnecessary loop in task_file_seq_get_next() Dan Carpenter
2024-07-04 21:55 ` Jiri Olsa
@ 2024-07-06 9:02 ` Christian Brauner
2024-07-06 15:40 ` Yonghong Song
2024-07-08 14:31 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Christian Brauner @ 2024-07-06 9:02 UTC (permalink / raw)
To: Dan Carpenter
Cc: Yonghong Song, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
bpf, linux-kernel, kernel-janitors
On Thu, Jul 04, 2024 at 10:19:19AM GMT, Dan Carpenter wrote:
> After commit 0ede61d8589c ("file: convert to SLAB_TYPESAFE_BY_RCU") this
> loop always iterates exactly one time. Delete the for statement and pull
> the code in a tab.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
Reviewed-by: Christian Brauner <brauner@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH bpf-next] bpf: remove unnecessary loop in task_file_seq_get_next()
2024-07-04 15:19 [PATCH bpf-next] bpf: remove unnecessary loop in task_file_seq_get_next() Dan Carpenter
2024-07-04 21:55 ` Jiri Olsa
2024-07-06 9:02 ` Christian Brauner
@ 2024-07-06 15:40 ` Yonghong Song
2024-07-08 14:31 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Yonghong Song @ 2024-07-06 15:40 UTC (permalink / raw)
To: Dan Carpenter, Christian Brauner
Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau, Eduard Zingerman, Song Liu, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, bpf,
linux-kernel, kernel-janitors
On 7/4/24 8:19 AM, Dan Carpenter wrote:
> After commit 0ede61d8589c ("file: convert to SLAB_TYPESAFE_BY_RCU") this
> loop always iterates exactly one time. Delete the for statement and pull
> the code in a tab.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
LGTM. Thanks for the cleanup.
Acked-by: Yonghong Song <yonghong.song@linux.dev>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH bpf-next] bpf: remove unnecessary loop in task_file_seq_get_next()
2024-07-04 15:19 [PATCH bpf-next] bpf: remove unnecessary loop in task_file_seq_get_next() Dan Carpenter
` (2 preceding siblings ...)
2024-07-06 15:40 ` Yonghong Song
@ 2024-07-08 14:31 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-07-08 14:31 UTC (permalink / raw)
To: Dan Carpenter
Cc: yonghong.song, brauner, ast, daniel, andrii, martin.lau, eddyz87,
song, john.fastabend, kpsingh, sdf, haoluo, jolsa, bpf,
linux-kernel, kernel-janitors
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:
On Thu, 4 Jul 2024 10:19:19 -0500 you wrote:
> After commit 0ede61d8589c ("file: convert to SLAB_TYPESAFE_BY_RCU") this
> loop always iterates exactly one time. Delete the for statement and pull
> the code in a tab.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> kernel/bpf/task_iter.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
Here is the summary with links:
- [bpf-next] bpf: remove unnecessary loop in task_file_seq_get_next()
https://git.kernel.org/bpf/bpf-next/c/bc239eb271e5
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread