OSDN Git Service

crypto: talitos - HMAC SNOOP NO AFEU mode requires SW icv checking.
[android-x86/kernel.git] / block / cfq-iosched.c
index 5e24d88..a4e2d01 100644 (file)
@@ -36,9 +36,13 @@ static const u64 cfq_target_latency = (u64)NSEC_PER_SEC * 3/10; /* 300 ms */
 static const int cfq_hist_divisor = 4;
 
 /*
- * offset from end of service tree
+ * offset from end of queue service tree for idle class
  */
 #define CFQ_IDLE_DELAY         (NSEC_PER_SEC / 5)
+/* offset from end of group service tree under time slice mode */
+#define CFQ_SLICE_MODE_GROUP_DELAY (NSEC_PER_SEC / 5)
+/* offset from end of group service under IOPS mode */
+#define CFQ_IOPS_MODE_GROUP_DELAY (HZ / 5)
 
 /*
  * below this threshold, we consider thinktime immediate
@@ -1370,6 +1374,14 @@ cfq_group_service_tree_add(struct cfq_rb_root *st, struct cfq_group *cfqg)
        cfqg->vfraction = max_t(unsigned, vfr, 1);
 }
 
+static inline u64 cfq_get_cfqg_vdisktime_delay(struct cfq_data *cfqd)
+{
+       if (!iops_mode(cfqd))
+               return CFQ_SLICE_MODE_GROUP_DELAY;
+       else
+               return CFQ_IOPS_MODE_GROUP_DELAY;
+}
+
 static void
 cfq_group_notify_queue_add(struct cfq_data *cfqd, struct cfq_group *cfqg)
 {
@@ -1389,7 +1401,8 @@ cfq_group_notify_queue_add(struct cfq_data *cfqd, struct cfq_group *cfqg)
        n = rb_last(&st->rb);
        if (n) {
                __cfqg = rb_entry_cfqg(n);
-               cfqg->vdisktime = __cfqg->vdisktime + CFQ_IDLE_DELAY;
+               cfqg->vdisktime = __cfqg->vdisktime +
+                       cfq_get_cfqg_vdisktime_delay(cfqd);
        } else
                cfqg->vdisktime = st->min_vdisktime;
        cfq_group_service_tree_add(st, cfqg);
@@ -1596,7 +1609,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;
@@ -2938,7 +2951,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));
@@ -3854,7 +3868,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;