Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1564961
| From | Oleg Nesterov <oleg@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | task_is_descendant() cleanup |
| Date | 2017-01-23 14:00 +0100 |
| Message-ID | <t2Mo2-6yJ-9@gated-at.bofh.it> (permalink) |
| References | <t1o4r-3Xc-59@gated-at.bofh.it> <t1LX3-2d6-5@gated-at.bofh.it> <t2LrY-5Y8-19@gated-at.bofh.it> <t2LrY-5Y8-17@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 01/23, Oleg Nesterov wrote:
>
> Btw task_is_descendant() looks wrong at first glance.
No, I missed the 2nd ->group_leader dereference. Still this function looks
overcomplicated and the usage of thread_group_leader/group_leader just add
the unnecessary confusion. It can be simplified a little bit:
static int task_is_descendant(struct task_struct *parent,
struct task_struct *child)
{
int rc = 0;
struct task_struct *walker;
if (!parent || !child)
return 0;
rcu_read_lock();
for (walker = child; walker->pid; walker = rcu_dereference(walker->real_parent))
if (same_thread_group(parent, walker)) {
rc = 1;
break;
}
rcu_read_unlock();
return rc;
}
Kees, I can send a patch if you think this very minor cleanup makes any sense.
Oleg.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] prctl: propagate has_child_subreaper flag to every descendant Pavel Tikhomirov <ptikhomirov@virtuozzo.com> - 2017-01-19 17:50 +0100
Re: [PATCH] prctl: propagate has_child_subreaper flag to every descendant Oleg Nesterov <oleg@redhat.com> - 2017-01-20 19:20 +0100
Re: [PATCH] prctl: propagate has_child_subreaper flag to every descendant Oleg Nesterov <oleg@redhat.com> - 2017-01-23 13:00 +0100
task_is_descendant() cleanup Oleg Nesterov <oleg@redhat.com> - 2017-01-23 14:00 +0100
Re: task_is_descendant() cleanup Kees Cook <keescook@chromium.org> - 2017-01-25 23:10 +0100
Re: task_is_descendant() cleanup Oleg Nesterov <oleg@redhat.com> - 2017-01-30 15:00 +0100
Re: [PATCH] prctl: propagate has_child_subreaper flag to every descendant Oleg Nesterov <oleg@redhat.com> - 2017-01-23 17:10 +0100
[PATCH] introduce the walk_process_tree() helper Oleg Nesterov <oleg@redhat.com> - 2017-01-23 13:00 +0100
Re: [PATCH] introduce the walk_process_tree() helper Oleg Nesterov <oleg@redhat.com> - 2017-01-23 13:10 +0100
setns() && PR_SET_CHILD_SUBREAPER Oleg Nesterov <oleg@redhat.com> - 2017-01-23 18:00 +0100
Re: setns() && PR_SET_CHILD_SUBREAPER ebiederm@xmission.com (Eric W. Biederman) - 2017-01-23 19:30 +0100
Re: setns() && PR_SET_CHILD_SUBREAPER Oleg Nesterov <oleg@redhat.com> - 2017-01-24 15:10 +0100
Re: setns() && PR_SET_CHILD_SUBREAPER ebiederm@xmission.com (Eric W. Biederman) - 2017-01-24 16:30 +0100
Re: setns() && PR_SET_CHILD_SUBREAPER Oleg Nesterov <oleg@redhat.com> - 2017-01-30 19:20 +0100
[PATCH] exit: fix the setns() && PR_SET_CHILD_SUBREAPER interaction Oleg Nesterov <oleg@redhat.com> - 2017-01-30 19:20 +0100
csiph-web