]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
cfq-iosched: fix async oom queue handling
authorTejun Heo <tj@kernel.org>
Tue, 18 Aug 2015 21:54:58 +0000 (14:54 -0700)
committerJens Axboe <axboe@fb.com>
Tue, 18 Aug 2015 22:49:15 +0000 (15:49 -0700)
Async cfqq's (cfq_queue's) are shared across cfq_data.  When
cfq_get_queue() obtains a new queue from cfq_find_alloc_queue(), it
stashes the pointer in cfq_data and reuses it from then on; however,
the function doesn't consider that cfq_find_alloc_queue() may return
the oom_cfqq under memory pressure and installs the returned queue
unconditionally.

If the oom_cfqq is installed as an async cfqq, cfq_set_request() will
continue calling cfq_get_queue() hoping to replace it with a proper
queue; however, cfq_get_queue() will keep returning the cached queue
for the slot - the oom_cfqq.

Fix it by skipping caching if the queue is the oom one.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Jeff Moyer <jmoyer@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Arianna Avanzini <avanzini.arianna@gmail.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/cfq-iosched.c

index e91093d0c0eb3cf4217269c8d29948c802b247d5..baf0b706169dae1f56bec26fa8119d4d8bd0b169 100644 (file)
@@ -3751,7 +3751,7 @@ cfq_get_queue(struct cfq_data *cfqd, bool is_sync, struct cfq_io_cq *cic,
        /*
         * pin the queue now that it's allocated, scheduler exit will prune it
         */
-       if (!is_sync) {
+       if (!is_sync && cfqq != &cfqd->oom_cfqq) {
                cfqq->ref++;
                *async_cfqq = cfqq;
        }