On Fri, May 18, 2018 at 11:27 PM, Tejun Heo <tj@xxxxxxxxxx> wrote: > Hello, Lai. > > On Thu, May 17, 2018 at 09:50:00PM +0800, Lai Jiangshan wrote: >> > +void wq_worker_comm(char *buf, size_t size, struct task_struct *task) >> > +{ >> > + struct worker *worker; >> > + struct worker_pool *pool; >> > + >> > + mutex_lock(&wq_pool_attach_mutex); >> > + >> >> Need to recheck >> task->flags | PF_WQ_WORKER >> again, because @task is often not the current task, >> the worker returned by kthread_data(task) >> could have been freed when the worker >> was destroyed. > > Hmm... but we're pinning the task and kthread_data doesn't get freed > till the task is released. I don't see how the worker could go away. > pinning the task doesn't stop the kthread_data from getting freed, especially when worker_thread() free kthread_data by itself. Even for rescuer_thread, it is hard to say if the kthread_data is being protected. > ... >> BTW, is it possible to keep attach_mutex >> unchanged? rcu_sched might be enough. > > It's simpler to use a global mutex, no? > > Thanks. > > -- > tejun -- To unsubscribe from this list: send the line "unsubscribe linux-api" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html