[Devel] [PATCH RHEL7 COMMIT] ms/cfq-iosched: don't call wbt_disable_default() with IRQs disabled

Konstantin Khorenko khorenko at virtuozzo.com
Wed Oct 30 18:57:14 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-1062.4.1.vz7.115.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1062.4.1.vz7.115.3
------>
commit c77a8b7da0d413fbdcf69f35bd3b9b8f501670f8
Author: Jens Axboe <axboe at fb.com>
Date:   Wed Oct 30 18:57:12 2019 +0300

    ms/cfq-iosched: don't call wbt_disable_default() with IRQs disabled
    
    wbt_disable_default() calls del_timer_sync() to wait for the wbt
    timer to finish before disabling throttling. We can't do this with
    IRQs disable. This fixes a lockdep splat on boot, if non-root
    cgroups are used.
    
    Reported-by: Gabriel C <nix.or.die at gmail.com>
    Fixes: 87760e5eef35 ("block: hook up writeback throttling")
    Signed-off-by: Jens Axboe <axboe at fb.com>
    
    Decided to backport during investigation of
    https://jira.sw.ru/browse/PSBM-99021
    
    (cherry picked from commit 5d7f5ce15156af205e175e8fa5c669ba40bf0c5e)
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
    Reviewed-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 block/cfq-iosched.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 1af4377ba938..350e9d740b60 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -3614,7 +3614,7 @@ static void cfq_init_cfqq(struct cfq_data *cfqd, struct cfq_queue *cfqq,
 }
 
 #ifdef CONFIG_CFQ_GROUP_IOSCHED
-static void check_blkcg_changed(struct cfq_io_cq *cic, struct bio *bio)
+static bool check_blkcg_changed(struct cfq_io_cq *cic, struct bio *bio)
 {
 	struct cfq_data *cfqd = cic_to_cfqd(cic);
 	struct cfq_queue *sync_cfqq;
@@ -3631,15 +3631,7 @@ static void check_blkcg_changed(struct cfq_io_cq *cic, struct bio *bio)
 	 * spuriously on a newly created cic but there's no harm.
 	 */
 	if (unlikely(!cfqd) || likely(cic->blkcg_id == id))
-		return;
-
-	/*
-	 * If we have a non-root cgroup, we can depend on that to
-	 * do proper throttling of writes. Turn off wbt for that
-	 * case, if it was enabled by default.
-	 */
-	if (nonroot_cg)
-		wbt_disable_default(cfqd->queue);
+		return nonroot_cg;
 
 	sync_cfqq = cic_to_cfqq(cic, 1);
 	if (sync_cfqq) {
@@ -3653,9 +3645,13 @@ static void check_blkcg_changed(struct cfq_io_cq *cic, struct bio *bio)
 	}
 
 	cic->blkcg_id = id;
+	return nonroot_cg;
 }
 #else
-static inline void check_blkcg_changed(struct cfq_io_cq *cic, struct bio *bio) { }
+static inline bool check_blkcg_changed(struct cfq_io_cq *cic, struct bio *bio)
+{
+	return false;
+}
 #endif  /* CONFIG_CFQ_GROUP_IOSCHED */
 
 static struct cfq_queue *
@@ -4282,11 +4278,12 @@ cfq_set_request(struct request_queue *q, struct request *rq, struct bio *bio,
 	const int rw = rq_data_dir(rq);
 	const bool is_sync = rq_is_sync(rq);
 	struct cfq_queue *cfqq;
+	bool disable_wbt;
 
 	spin_lock_irq(q->queue_lock);
 
 	check_ioprio_changed(cic, bio);
-	check_blkcg_changed(cic, bio);
+	disable_wbt = check_blkcg_changed(cic, bio);
 new_queue:
 	cfqq = cic_to_cfqq(cic, is_sync);
 	if (!cfqq || cfqq == &cfqd->oom_cfqq) {
@@ -4322,6 +4319,10 @@ cfq_set_request(struct request_queue *q, struct request *rq, struct bio *bio,
 	rq->elv.priv[0] = cfqq;
 	rq->elv.priv[1] = cfqq->cfqg;
 	spin_unlock_irq(q->queue_lock);
+
+	if (disable_wbt)
+		wbt_disable_default(q);
+
 	return 0;
 }
 



More information about the Devel mailing list