Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1507650
| From | Roman Penyaev <roman.penyaev@profitbricks.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2 2/2] workqueue: ignore dead tasks in a workqueue sleep hook |
| Date | 2016-10-24 21:20 +0200 |
| Message-ID | <svSWS-3rd-37@gated-at.bofh.it> (permalink) |
| References | <svPYZ-1uD-5@gated-at.bofh.it> <svPYZ-1uD-3@gated-at.bofh.it> <svQBH-1Ks-23@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Oct 24, 2016 at 6:40 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Mon, Oct 24, 2016 at 06:08:14PM +0200, Roman Pen wrote:
>
>> --- a/kernel/workqueue.c
>> +++ b/kernel/workqueue.c
>> @@ -875,9 +875,31 @@ void wq_worker_waking_up(struct task_struct *task, int cpu)
>> */
>> struct task_struct *wq_worker_sleeping(struct task_struct *task)
>> {
>> - struct worker *worker = kthread_data(task), *to_wakeup = NULL;
>> + struct worker *worker, *to_wakeup = NULL;
>> struct worker_pool *pool;
>>
>> +
>> + if (task->state == TASK_DEAD)
>> + /* Here we try to catch the following path before
>> + * accessing NULL kthread->vfork_done ptr thru
>> + * kthread_data():
>> + *
>> + * oops_end()
>> + * do_exit()
>> + * schedule()
>> + *
>> + * If panic_on_oops is not set and oops happens on
>> + * a workqueue execution path, thread will be killed.
>> + * That is definitly sad, but not to make the situation
>> + * even worse we have to ignore dead tasks in order not
>> + * to step on zeroed out members (e.g. t->vfork_done is
>> + * already NULL on that path, since we were called by
>> + * do_exit())).
>> + */
>> + return NULL;
>
> https://lkml.kernel.org/r/CA+55aFyQYJerovMsSoSKS7PessZBr4vNp-3QUUwhqk4A4_jcbg@mail.gmail.com
Ha, explicit comment from Linus :) Ok.
> Also, that misses { }.
Ok.
--
Roman
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 2/2] workqueue: ignore dead tasks in a workqueue sleep hook Roman Pen <roman.penyaev@profitbricks.com> - 2016-10-24 18:10 +0200
Re: [PATCH v2 2/2] workqueue: ignore dead tasks in a workqueue sleep hook Peter Zijlstra <peterz@infradead.org> - 2016-10-24 18:50 +0200
Re: [PATCH v2 2/2] workqueue: ignore dead tasks in a workqueue sleep hook Roman Penyaev <roman.penyaev@profitbricks.com> - 2016-10-24 21:20 +0200
Re: [PATCH v2 2/2] workqueue: ignore dead tasks in a workqueue sleep hook Tejun Heo <tj@kernel.org> - 2016-10-24 22:30 +0200
csiph-web