OSDN Git Service

PCI: keystone: Fix link training retries initiation
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / block / cfq-iosched.c
index 1f9093e..4e1f494 100644 (file)
@@ -1572,7 +1572,7 @@ static struct blkcg_policy_data *cfq_cpd_alloc(gfp_t gfp)
 {
        struct cfq_group_data *cgd;
 
-       cgd = kzalloc(sizeof(*cgd), GFP_KERNEL);
+       cgd = kzalloc(sizeof(*cgd), gfp);
        if (!cgd)
                return NULL;
        return &cgd->cpd;
@@ -2905,7 +2905,8 @@ static void cfq_arm_slice_timer(struct cfq_data *cfqd)
         * for devices that support queuing, otherwise we still have a problem
         * with sync vs async workloads.
         */
-       if (blk_queue_nonrot(cfqd->queue) && cfqd->hw_tag)
+       if (blk_queue_nonrot(cfqd->queue) && cfqd->hw_tag &&
+               !cfqd->cfq_group_idle)
                return;
 
        WARN_ON(!RB_EMPTY_ROOT(&cfqq->sort_list));
@@ -3003,7 +3004,6 @@ static struct request *cfq_check_fifo(struct cfq_queue *cfqq)
        if (time_before(jiffies, rq->fifo_time))
                rq = NULL;
 
-       cfq_log_cfqq(cfqq->cfqd, cfqq, "fifo=%p", rq);
        return rq;
 }
 
@@ -3377,6 +3377,9 @@ static bool cfq_may_dispatch(struct cfq_data *cfqd, struct cfq_queue *cfqq)
 {
        unsigned int max_dispatch;
 
+       if (cfq_cfqq_must_dispatch(cfqq))
+               return true;
+
        /*
         * Drain async requests before we start sync IO
         */
@@ -3468,15 +3471,20 @@ static bool cfq_dispatch_request(struct cfq_data *cfqd, struct cfq_queue *cfqq)
 
        BUG_ON(RB_EMPTY_ROOT(&cfqq->sort_list));
 
+       rq = cfq_check_fifo(cfqq);
+       if (rq)
+               cfq_mark_cfqq_must_dispatch(cfqq);
+
        if (!cfq_may_dispatch(cfqd, cfqq))
                return false;
 
        /*
         * follow expired path, else get first next available
         */
-       rq = cfq_check_fifo(cfqq);
        if (!rq)
                rq = cfqq->next_rq;
+       else
+               cfq_log_cfqq(cfqq->cfqd, cfqq, "fifo=%p", rq);
 
        /*
         * insert request into driver dispatch list
@@ -3803,7 +3811,8 @@ cfq_get_queue(struct cfq_data *cfqd, bool is_sync, struct cfq_io_cq *cic,
                        goto out;
        }
 
-       cfqq = kmem_cache_alloc_node(cfq_pool, GFP_NOWAIT | __GFP_ZERO,
+       cfqq = kmem_cache_alloc_node(cfq_pool,
+                                    GFP_NOWAIT | __GFP_ZERO | __GFP_NOWARN,
                                     cfqd->queue->node);
        if (!cfqq) {
                cfqq = &cfqd->oom_cfqq;
@@ -3944,7 +3953,7 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
         * if the new request is sync, but the currently running queue is
         * not, let the sync request have priority.
         */
-       if (rq_is_sync(rq) && !cfq_cfqq_sync(cfqq))
+       if (rq_is_sync(rq) && !cfq_cfqq_sync(cfqq) && !cfq_cfqq_must_dispatch(cfqq))
                return true;
 
        if (new_cfqq->cfqg != cfqq->cfqg)