Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 865176 Details for
Bug 958505
Stale zombie/<defunct> process
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
[PATCH] kill DEAD->ZOMBIE transition
ALL.p (text/plain), 3.42 KB, created by
Oleg Nesterov
on 2014-02-19 18:29:54 UTC
(
hide
)
Description:
[PATCH] kill DEAD->ZOMBIE transition
Filename:
MIME Type:
Creator:
Oleg Nesterov
Created:
2014-02-19 18:29:54 UTC
Size:
3.42 KB
patch
obsolete
>diff --git a/include/linux/sched.h b/include/linux/sched.h >index a781dec..6b4f55d 100644 >--- a/include/linux/sched.h >+++ b/include/linux/sched.h >@@ -206,6 +206,9 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq); > /* in tsk->exit_state */ > #define EXIT_ZOMBIE 16 > #define EXIT_DEAD 32 >+ >+#define EXIT_TRACE (EXIT_ZOMBIE | EXIT_DEAD) >+ > /* in tsk->state again */ > #define TASK_DEAD 64 > #define TASK_WAKEKILL 128 >diff --git a/kernel/exit.c b/kernel/exit.c >index 1e77fc6..10a1528 100644 >--- a/kernel/exit.c >+++ b/kernel/exit.c >@@ -1038,17 +1038,13 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p) > return wait_noreap_copyout(wo, p, pid, uid, why, status); > } > >+ traced = ptrace_reparented(p); > /* >- * Try to move the task's state to DEAD >- * only one thread is allowed to do this: >+ * Move the task's state to DEAD/TRACE, only one thread can do this. > */ >- state = xchg(&p->exit_state, EXIT_DEAD); >- if (state != EXIT_ZOMBIE) { >- BUG_ON(state != EXIT_DEAD); >+ state = traced && thread_group_leader(p) ? EXIT_TRACE : EXIT_DEAD; >+ if (cmpxchg(&p->exit_state, EXIT_ZOMBIE, state) != EXIT_ZOMBIE) > return 0; >- } >- >- traced = ptrace_reparented(p); > /* > * It can be ptraced but not reparented, check > * thread_group_leader() to filter out sub-threads. >@@ -1109,7 +1105,7 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p) > > /* > * Now we are sure this task is interesting, and no other >- * thread can reap it because we set its state to EXIT_DEAD. >+ * thread can reap it because we its state == DEAD/TRACE. > */ > read_unlock(&tasklist_lock); > >@@ -1146,22 +1142,19 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p) > if (!retval) > retval = pid; > >- if (traced) { >+ if (state == EXIT_TRACE) { > write_lock_irq(&tasklist_lock); > /* We dropped tasklist, ptracer could die and untrace */ > ptrace_unlink(p); >- /* >- * If this is not a sub-thread, notify the parent. >- * If parent wants a zombie, don't release it now. >- */ >- if (thread_group_leader(p) && >- !do_notify_parent(p, p->exit_signal)) { >- p->exit_state = EXIT_ZOMBIE; >- p = NULL; >- } >+ >+ /* If parent wants a zombie, don't release it now */ >+ state = EXIT_ZOMBIE; >+ if (do_notify_parent(p, p->exit_signal)) >+ state = EXIT_DEAD; >+ p->exit_state = state; > write_unlock_irq(&tasklist_lock); > } >- if (p != NULL) >+ if (state == EXIT_DEAD) > release_task(p); > > return retval; >@@ -1338,7 +1331,13 @@ static int wait_task_continued(struct wait_opts *wo, struct task_struct *p) > static int wait_consider_task(struct wait_opts *wo, int ptrace, > struct task_struct *p) > { >- int ret = eligible_child(wo, p); >+ int ret; >+ >+ /* dead body doesn't have much to contribute */ >+ if (unlikely(p->exit_state == EXIT_DEAD)) >+ return 0; >+ >+ ret = eligible_child(wo, p); > if (!ret) > return ret; > >@@ -1356,13 +1355,12 @@ static int wait_consider_task(struct wait_opts *wo, int ptrace, > return 0; > } > >- /* dead body doesn't have much to contribute */ >- if (unlikely(p->exit_state == EXIT_DEAD)) { >+ if (unlikely(p->exit_state == EXIT_TRACE)) { > /* >- * But do not ignore this task until the tracer does >- * wait_task_zombie()->do_notify_parent(). >+ * ptrace == 0 means we are the natural parent. In this case >+ * we should clear notask_error, debugger will notify us. > */ >- if (likely(!ptrace) && unlikely(ptrace_reparented(p))) >+ if (likely(!ptrace)) > wo->notask_error = 0; > return 0; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 958505
:
742272
|
758391
|
758857
|
864639
| 865176