bpf: task_group_seq_get_next: simplify the "next tid" logic
authorOleg Nesterov <oleg@redhat.com>
Tue, 5 Sep 2023 15:46:56 +0000 (17:46 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 8 Sep 2023 15:42:19 +0000 (08:42 -0700)
commit780aa8dfcb73f4703b1c4be11c21c8dca36502ad
treecd1914df315c0b10386433d457cb011e354b9522
parent0ee9808b0a211ba1e572073c6afe5897f8300b9c
bpf: task_group_seq_get_next: simplify the "next tid" logic

Kill saved_tid. It looks ugly to update *tid and then restore the
previous value if __task_pid_nr_ns() returns 0. Change this code
to update *tid and common->pid_visiting once before return.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/r/20230905154656.GA24950@redhat.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/task_iter.c