public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] io-wq: fix 'task->pi_lock' spin lock protect
@ 2020-10-23  6:20 qiang.zhang
  2020-10-23 13:23 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: qiang.zhang @ 2020-10-23  6:20 UTC (permalink / raw)
  To: axboe; +Cc: viro, linux-fsdevel, io-uring, linux-kernel

From: Zqiang <[email protected]>

The set CPU affinity func 'do_set_cpus_allowed' may be operate
'task_rq', need add rq lock protect, replace 'pi_lock' spinlock
protect with task_rq_lock func.

Signed-off-by: Zqiang <[email protected]>
---
 fs/io-wq.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/io-wq.c b/fs/io-wq.c
index d3165ce339c2..6ea3e0224e63 100644
--- a/fs/io-wq.c
+++ b/fs/io-wq.c
@@ -1209,11 +1209,13 @@ static bool io_wq_worker_affinity(struct io_worker *worker, void *data)
 {
 	struct task_struct *task = worker->task;
 	unsigned long flags;
+	struct rq_flags rf;
+	struct rq *rq;
 
-	raw_spin_lock_irqsave(&task->pi_lock, flags);
+	rq = task_rq_lock(task, &rf);
 	do_set_cpus_allowed(task, cpumask_of_node(worker->wqe->node));
 	task->flags |= PF_NO_SETAFFINITY;
-	raw_spin_unlock_irqrestore(&task->pi_lock, flags);
+	task_rq_unlock(rq, task, &rf);
 	return false;
 }
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] io-wq: fix 'task->pi_lock' spin lock protect
  2020-10-23  6:20 [PATCH] io-wq: fix 'task->pi_lock' spin lock protect qiang.zhang
@ 2020-10-23 13:23 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2020-10-23 13:23 UTC (permalink / raw)
  To: qiang.zhang; +Cc: viro, linux-fsdevel, io-uring, linux-kernel

On 10/23/20 12:20 AM, [email protected] wrote:
> From: Zqiang <[email protected]>
> 
> The set CPU affinity func 'do_set_cpus_allowed' may be operate
> 'task_rq', need add rq lock protect, replace 'pi_lock' spinlock
> protect with task_rq_lock func.

Thanks, I'm going to fold this one.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-23 13:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-23  6:20 [PATCH] io-wq: fix 'task->pi_lock' spin lock protect qiang.zhang
2020-10-23 13:23 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox