From: Jens Axboe Date: Thu, 1 Jun 2006 08:13:43 +0000 (+0200) Subject: [PATCH] cfq-iosched: fix bug in timer handling for the idle class X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ae818a38d4755ba4c16a22a8eacec859511a5393;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [PATCH] cfq-iosched: fix bug in timer handling for the idle class There's a small window from when the timer is entered and we grab the queue lock, where cfq_set_active_queue() could be rearming the timer for us. Seen in the wild on a 12-way ppc box. Fix this by just using mod_timer(), which will do the right thing for us. Signed-off-by: Jens Axboe --- diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 5d2047b93eb5..85d188a30f82 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c @@ -2193,10 +2193,9 @@ static void cfq_idle_class_timer(unsigned long data) * race with a non-idle queue, reset timer */ end = cfqd->last_end_request + CFQ_IDLE_GRACE; - if (!time_after_eq(jiffies, end)) { - cfqd->idle_class_timer.expires = end; - add_timer(&cfqd->idle_class_timer); - } else + if (!time_after_eq(jiffies, end)) + mod_timer(&cfqd->idle_class_timer, end); + else cfq_schedule_dispatch(cfqd); spin_unlock_irqrestore(cfqd->queue->queue_lock, flags);