lkml.org 
[lkml]   [2008]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] processes: reparent_thread: don't call kill_orphaned_pgrp() if task_detached()
Date
> Needs an ack from someone who understands orphaned groups.

I understand what the semantics are supposed to be.
But I'm getting a headache trying to see if I really understand the code.

> If task_detached(p) == T, then either
>
> a) p is not the main thread, we will find the group leader
> on the ->children list.

Correct.

> or
> b) p is the group leader but its ->exit_state = EXIT_DEAD.
> This can only happen when the last sub-thread has died,
> but in that case that thread has already called
> kill_orphaned_pgrp() from exit_notify().

I think that's right too.

> @@ -816,6 +816,8 @@ static void reparent_thread(struct task_
>
> list_move_tail(&p->sibling, &p->real_parent->children);
>
> + if (task_detached(p))
> + return;

Seems like it would be cleaner to reorganize the code a little.
reparent_thread has only one caller. How about we move:

if (p->pdeath_signal)
/* We already hold the tasklist_lock here. */
group_send_sig_info(p->pdeath_signal, SEND_SIG_NOINFO, p);

list_move_tail(&p->sibling, &p->real_parent->children);

into forget_original_parent and rename reparent_thread to something else,
called only:

if (!task_detached(p) && !same_thread_group(p->real_parent, father))
orphaned_process(p);


Thanks,
Roland


\
 
 \ /
  Last update: 2008-12-04 01:57    [W:0.233 / U:0.532 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site