提交 91151228 编写于 作者: O Oleg Nesterov 提交者: Tejun Heo

workqueue: swap set_cpus_allowed_ptr() and PF_NO_SETAFFINITY

Move the setting of PF_NO_SETAFFINITY up before set_cpus_allowed()
in create_worker(). Otherwise userland can change ->cpus_allowed
in between.
Signed-off-by: NOleg Nesterov <oleg@redhat.com>
Signed-off-by: NTejun Heo <tj@kernel.org>
上级 6ce4eac1
...@@ -1736,16 +1736,17 @@ static struct worker *create_worker(struct worker_pool *pool) ...@@ -1736,16 +1736,17 @@ static struct worker *create_worker(struct worker_pool *pool)
if (IS_ERR(worker->task)) if (IS_ERR(worker->task))
goto fail; goto fail;
set_user_nice(worker->task, pool->attrs->nice);
/* prevent userland from meddling with cpumask of workqueue workers */
worker->task->flags |= PF_NO_SETAFFINITY;
/* /*
* set_cpus_allowed_ptr() will fail if the cpumask doesn't have any * set_cpus_allowed_ptr() will fail if the cpumask doesn't have any
* online CPUs. It'll be re-applied when any of the CPUs come up. * online CPUs. It'll be re-applied when any of the CPUs come up.
*/ */
set_user_nice(worker->task, pool->attrs->nice);
set_cpus_allowed_ptr(worker->task, pool->attrs->cpumask); set_cpus_allowed_ptr(worker->task, pool->attrs->cpumask);
/* prevent userland from meddling with cpumask of workqueue workers */
worker->task->flags |= PF_NO_SETAFFINITY;
/* /*
* The caller is responsible for ensuring %POOL_DISASSOCIATED * The caller is responsible for ensuring %POOL_DISASSOCIATED
* remains stable across this function. See the comments above the * remains stable across this function. See the comments above the
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册