summaryrefslogtreecommitdiffstats
path: root/fs/io-wq.c
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2021-04-08 11:44:50 +0200
committerJens Axboe <axboe@kernel.dk>2021-04-11 19:30:40 -0600
commite0051d7d18e0b3e25195ab332beea1a1a2fba5ca (patch)
tree10b9dbeb549c4f60a681525901a725205e127f4c /fs/io-wq.c
parentcb3b200e4f66524d03d6410dd51bcf42f265a4d0 (diff)
downloadlinux-e0051d7d18e0b3e25195ab332beea1a1a2fba5ca.tar.bz2
io-wq: Fix io_wq_worker_affinity()
Do not include private headers and do not frob in internals. On top of that, while the previous code restores the affinity, it doesn't ensure the task actually moves there if it was running, leading to the fun situation that it can be observed running outside of its allowed mask for potentially significant time. Use the proper API instead. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/YG7QkiUzlEbW85TU@hirez.programming.kicks-ass.net Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io-wq.c')
-rw-r--r--fs/io-wq.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/fs/io-wq.c b/fs/io-wq.c
index b1c093de9723..49def8714083 100644
--- a/fs/io-wq.c
+++ b/fs/io-wq.c
@@ -17,7 +17,6 @@
#include <linux/cpu.h>
#include <linux/tracehook.h>
-#include "../kernel/sched/sched.h"
#include "io-wq.h"
#define WORKER_IDLE_TIMEOUT (5 * HZ)
@@ -1064,14 +1063,8 @@ void io_wq_put_and_exit(struct io_wq *wq)
static bool io_wq_worker_affinity(struct io_worker *worker, void *data)
{
- struct task_struct *task = worker->task;
- struct rq_flags rf;
- struct rq *rq;
-
- rq = task_rq_lock(task, &rf);
- do_set_cpus_allowed(task, cpumask_of_node(worker->wqe->node));
- task->flags |= PF_NO_SETAFFINITY;
- task_rq_unlock(rq, task, &rf);
+ set_cpus_allowed_ptr(worker->task, cpumask_of_node(worker->wqe->node));
+
return false;
}