2020-06-23 13:42:59 +00:00
|
|
|
From ec866f740d2ecbb5a86266c2aee383f462c9bbb5 Mon Sep 17 00:00:00 2001
|
|
|
|
Message-Id: <ec866f740d2ecbb5a86266c2aee383f462c9bbb5.1592846147.git.zanussi@kernel.org>
|
|
|
|
In-Reply-To: <07cd0dbc80b976663c80755496a03f288decfe5a.1592846146.git.zanussi@kernel.org>
|
|
|
|
References: <07cd0dbc80b976663c80755496a03f288decfe5a.1592846146.git.zanussi@kernel.org>
|
2018-08-27 14:32:32 +00:00
|
|
|
From: Thomas Gleixner <tglx@linutronix.de>
|
|
|
|
Date: Thu, 20 Dec 2012 18:28:26 +0100
|
2020-06-23 13:42:59 +00:00
|
|
|
Subject: [PATCH 186/330] block: Use cpu_chill() for retry loops
|
|
|
|
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.127-rt55.tar.xz
|
2018-08-27 14:32:32 +00:00
|
|
|
|
|
|
|
Retry loops on RT might loop forever when the modifying side was
|
|
|
|
preempted. Steven also observed a live lock when there was a
|
|
|
|
concurrent priority boosting going on.
|
|
|
|
|
|
|
|
Use cpu_chill() instead of cpu_relax() to let the system
|
|
|
|
make progress.
|
|
|
|
|
|
|
|
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
|
|
|
---
|
2019-04-08 23:49:20 +00:00
|
|
|
block/blk-ioc.c | 5 +++--
|
2018-08-27 14:32:32 +00:00
|
|
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
|
|
2019-04-08 23:49:20 +00:00
|
|
|
diff --git a/block/blk-ioc.c b/block/blk-ioc.c
|
2020-06-22 13:14:16 +00:00
|
|
|
index 4c810969c3e2..48089f5bcc11 100644
|
2018-08-27 14:32:32 +00:00
|
|
|
--- a/block/blk-ioc.c
|
|
|
|
+++ b/block/blk-ioc.c
|
|
|
|
@@ -9,6 +9,7 @@
|
|
|
|
#include <linux/blkdev.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/sched/task.h>
|
|
|
|
+#include <linux/delay.h>
|
|
|
|
|
|
|
|
#include "blk.h"
|
|
|
|
|
2020-06-22 13:14:16 +00:00
|
|
|
@@ -119,7 +120,7 @@ static void ioc_release_fn(struct work_struct *work)
|
2018-08-27 14:32:32 +00:00
|
|
|
spin_unlock(q->queue_lock);
|
|
|
|
} else {
|
|
|
|
spin_unlock_irqrestore(&ioc->lock, flags);
|
|
|
|
- cpu_relax();
|
|
|
|
+ cpu_chill();
|
|
|
|
spin_lock_irqsave_nested(&ioc->lock, flags, 1);
|
|
|
|
}
|
|
|
|
}
|
2020-06-22 13:14:16 +00:00
|
|
|
@@ -203,7 +204,7 @@ void put_io_context_active(struct io_context *ioc)
|
2018-08-27 14:32:32 +00:00
|
|
|
spin_unlock(icq->q->queue_lock);
|
|
|
|
} else {
|
|
|
|
spin_unlock_irqrestore(&ioc->lock, flags);
|
|
|
|
- cpu_relax();
|
|
|
|
+ cpu_chill();
|
|
|
|
goto retry;
|
|
|
|
}
|
|
|
|
}
|
2020-01-03 23:36:11 +00:00
|
|
|
--
|
2020-06-22 13:14:16 +00:00
|
|
|
2.17.1
|
2020-01-03 23:36:11 +00:00
|
|
|
|