mirror of
https://github.com/torvalds/linux.git
synced 2025-11-02 17:49:03 +02:00
bpf: task_group_seq_get_next: kill next_task
It only adds the unnecessary confusion and compicates the "retry" code. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Yonghong Song <yonghong.song@linux.dev> Link: https://lore.kernel.org/r/20230905154654.GA24945@redhat.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
87abbf7a54
commit
0ee9808b0a
1 changed files with 6 additions and 8 deletions
|
|
@ -35,7 +35,7 @@ static struct task_struct *task_group_seq_get_next(struct bpf_iter_seq_task_comm
|
||||||
u32 *tid,
|
u32 *tid,
|
||||||
bool skip_if_dup_files)
|
bool skip_if_dup_files)
|
||||||
{
|
{
|
||||||
struct task_struct *task, *next_task;
|
struct task_struct *task;
|
||||||
struct pid *pid;
|
struct pid *pid;
|
||||||
u32 saved_tid;
|
u32 saved_tid;
|
||||||
|
|
||||||
|
|
@ -68,10 +68,10 @@ static struct task_struct *task_group_seq_get_next(struct bpf_iter_seq_task_comm
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
next_task = next_thread(task);
|
task = next_thread(task);
|
||||||
|
|
||||||
saved_tid = *tid;
|
saved_tid = *tid;
|
||||||
*tid = __task_pid_nr_ns(next_task, PIDTYPE_PID, common->ns);
|
*tid = __task_pid_nr_ns(task, PIDTYPE_PID, common->ns);
|
||||||
if (!*tid || *tid == common->pid) {
|
if (!*tid || *tid == common->pid) {
|
||||||
/* Run out of tasks of a process. The tasks of a
|
/* Run out of tasks of a process. The tasks of a
|
||||||
* thread_group are linked as circular linked list.
|
* thread_group are linked as circular linked list.
|
||||||
|
|
@ -82,13 +82,11 @@ static struct task_struct *task_group_seq_get_next(struct bpf_iter_seq_task_comm
|
||||||
|
|
||||||
common->pid_visiting = *tid;
|
common->pid_visiting = *tid;
|
||||||
|
|
||||||
if (skip_if_dup_files && next_task->files == next_task->group_leader->files) {
|
if (skip_if_dup_files && task->files == task->group_leader->files)
|
||||||
task = next_task;
|
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
|
||||||
|
|
||||||
get_task_struct(next_task);
|
get_task_struct(task);
|
||||||
return next_task;
|
return task;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct task_struct *task_seq_get_next(struct bpf_iter_seq_task_common *common,
|
static struct task_struct *task_seq_get_next(struct bpf_iter_seq_task_common *common,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue