[Devel] [PATCH RHEL7 COMMIT] ms/cfq-iosched: fix async oom queue handling

Konstantin Khorenko khorenko at virtuozzo.com
Mon Nov 23 07:30:37 PST 2015


The commit is pushed to "branch-rh7-3.10.0-229.7.2.vz7.9.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-229.7.2.vz7.9.12
------>
commit 93edfd2e140d8525c2090ce6e526f303b6490e1c
Author: Tejun Heo <tj at kernel.org>
Date:   Mon Nov 23 19:30:37 2015 +0400

    ms/cfq-iosched: fix async oom queue handling
    
    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 at kernel.org>
    Acked-by: Jeff Moyer <jmoyer at redhat.com>
    Cc: Vivek Goyal <vgoyal at redhat.com>
    Cc: Arianna Avanzini <avanzini.arianna at gmail.com>
    Signed-off-by: Jens Axboe <axboe at fb.com>
    
    https://jira.sw.ru/browse/PSBM-41334
    
    (cherry picked from commit 95e5d6f62693f27d9011ec307eb32c6126314ea3)
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 block/cfq-iosched.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index a4149c3..911baae 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -3711,7 +3711,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;
 	}


More information about the Devel mailing list