aboutsummaryrefslogtreecommitdiffstats
path: root/block/cfq-iosched.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/cfq-iosched.c')
-rw-r--r--block/cfq-iosched.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index dee9d9378fee..2c7a0f4f3cd7 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -47,6 +47,7 @@ static const int cfq_hist_divisor = 4;
47#define CFQ_SERVICE_SHIFT 12 47#define CFQ_SERVICE_SHIFT 12
48 48
49#define CFQQ_SEEK_THR (sector_t)(8 * 100) 49#define CFQQ_SEEK_THR (sector_t)(8 * 100)
50#define CFQQ_CLOSE_THR (sector_t)(8 * 1024)
50#define CFQQ_SECT_THR_NONROT (sector_t)(2 * 32) 51#define CFQQ_SECT_THR_NONROT (sector_t)(2 * 32)
51#define CFQQ_SEEKY(cfqq) (hweight32(cfqq->seek_history) > 32/8) 52#define CFQQ_SEEKY(cfqq) (hweight32(cfqq->seek_history) > 32/8)
52 53
@@ -1517,7 +1518,8 @@ static void __cfq_set_active_queue(struct cfq_data *cfqd,
1517 struct cfq_queue *cfqq) 1518 struct cfq_queue *cfqq)
1518{ 1519{
1519 if (cfqq) { 1520 if (cfqq) {
1520 cfq_log_cfqq(cfqd, cfqq, "set_active"); 1521 cfq_log_cfqq(cfqd, cfqq, "set_active wl_prio:%d wl_type:%d",
1522 cfqd->serving_prio, cfqd->serving_type);
1521 cfqq->slice_start = 0; 1523 cfqq->slice_start = 0;
1522 cfqq->dispatch_start = jiffies; 1524 cfqq->dispatch_start = jiffies;
1523 cfqq->allocated_slice = 0; 1525 cfqq->allocated_slice = 0;
@@ -1660,9 +1662,9 @@ static inline sector_t cfq_dist_from_last(struct cfq_data *cfqd,
1660} 1662}
1661 1663
1662static inline int cfq_rq_close(struct cfq_data *cfqd, struct cfq_queue *cfqq, 1664static inline int cfq_rq_close(struct cfq_data *cfqd, struct cfq_queue *cfqq,
1663 struct request *rq, bool for_preempt) 1665 struct request *rq)
1664{ 1666{
1665 return cfq_dist_from_last(cfqd, rq) <= CFQQ_SEEK_THR; 1667 return cfq_dist_from_last(cfqd, rq) <= CFQQ_CLOSE_THR;
1666} 1668}
1667 1669
1668static struct cfq_queue *cfqq_close(struct cfq_data *cfqd, 1670static struct cfq_queue *cfqq_close(struct cfq_data *cfqd,
@@ -1689,7 +1691,7 @@ static struct cfq_queue *cfqq_close(struct cfq_data *cfqd,
1689 * will contain the closest sector. 1691 * will contain the closest sector.
1690 */ 1692 */
1691 __cfqq = rb_entry(parent, struct cfq_queue, p_node); 1693 __cfqq = rb_entry(parent, struct cfq_queue, p_node);
1692 if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq, false)) 1694 if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq))
1693 return __cfqq; 1695 return __cfqq;
1694 1696
1695 if (blk_rq_pos(__cfqq->next_rq) < sector) 1697 if (blk_rq_pos(__cfqq->next_rq) < sector)
@@ -1700,7 +1702,7 @@ static struct cfq_queue *cfqq_close(struct cfq_data *cfqd,
1700 return NULL; 1702 return NULL;
1701 1703
1702 __cfqq = rb_entry(node, struct cfq_queue, p_node); 1704 __cfqq = rb_entry(node, struct cfq_queue, p_node);
1703 if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq, false)) 1705 if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq))
1704 return __cfqq; 1706 return __cfqq;
1705 1707
1706 return NULL; 1708 return NULL;
@@ -1721,6 +1723,8 @@ static struct cfq_queue *cfq_close_cooperator(struct cfq_data *cfqd,
1721{ 1723{
1722 struct cfq_queue *cfqq; 1724 struct cfq_queue *cfqq;
1723 1725
1726 if (cfq_class_idle(cur_cfqq))
1727 return NULL;
1724 if (!cfq_cfqq_sync(cur_cfqq)) 1728 if (!cfq_cfqq_sync(cur_cfqq))
1725 return NULL; 1729 return NULL;
1726 if (CFQQ_SEEKY(cur_cfqq)) 1730 if (CFQQ_SEEKY(cur_cfqq))
@@ -1787,7 +1791,11 @@ static bool cfq_should_idle(struct cfq_data *cfqd, struct cfq_queue *cfqq)
1787 * Otherwise, we do only if they are the last ones 1791 * Otherwise, we do only if they are the last ones
1788 * in their service tree. 1792 * in their service tree.
1789 */ 1793 */
1790 return service_tree->count == 1 && cfq_cfqq_sync(cfqq); 1794 if (service_tree->count == 1 && cfq_cfqq_sync(cfqq))
1795 return 1;
1796 cfq_log_cfqq(cfqd, cfqq, "Not idling. st->count:%d",
1797 service_tree->count);
1798 return 0;
1791} 1799}
1792 1800
1793static void cfq_arm_slice_timer(struct cfq_data *cfqd) 1801static void cfq_arm_slice_timer(struct cfq_data *cfqd)
@@ -1832,8 +1840,11 @@ static void cfq_arm_slice_timer(struct cfq_data *cfqd)
1832 * time slice. 1840 * time slice.
1833 */ 1841 */
1834 if (sample_valid(cic->ttime_samples) && 1842 if (sample_valid(cic->ttime_samples) &&
1835 (cfqq->slice_end - jiffies < cic->ttime_mean)) 1843 (cfqq->slice_end - jiffies < cic->ttime_mean)) {
1844 cfq_log_cfqq(cfqd, cfqq, "Not idling. think_time:%d",
1845 cic->ttime_mean);
1836 return; 1846 return;
1847 }
1837 1848
1838 cfq_mark_cfqq_wait_request(cfqq); 1849 cfq_mark_cfqq_wait_request(cfqq);
1839 1850
@@ -2041,6 +2052,7 @@ static void choose_service_tree(struct cfq_data *cfqd, struct cfq_group *cfqg)
2041 slice = max(slice, 2 * cfqd->cfq_slice_idle); 2052 slice = max(slice, 2 * cfqd->cfq_slice_idle);
2042 2053
2043 slice = max_t(unsigned, slice, CFQ_MIN_TT); 2054 slice = max_t(unsigned, slice, CFQ_MIN_TT);
2055 cfq_log(cfqd, "workload slice:%d", slice);
2044 cfqd->workload_expires = jiffies + slice; 2056 cfqd->workload_expires = jiffies + slice;
2045 cfqd->noidle_tree_requires_idle = false; 2057 cfqd->noidle_tree_requires_idle = false;
2046} 2058}
@@ -3103,7 +3115,7 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
3103 * if this request is as-good as one we would expect from the 3115 * if this request is as-good as one we would expect from the
3104 * current cfqq, let it preempt 3116 * current cfqq, let it preempt
3105 */ 3117 */
3106 if (cfq_rq_close(cfqd, cfqq, rq, true)) 3118 if (cfq_rq_close(cfqd, cfqq, rq))
3107 return true; 3119 return true;
3108 3120
3109 return false; 3121 return false;
@@ -3307,6 +3319,7 @@ static void cfq_completed_request(struct request_queue *q, struct request *rq)
3307 if (cfq_should_wait_busy(cfqd, cfqq)) { 3319 if (cfq_should_wait_busy(cfqd, cfqq)) {
3308 cfqq->slice_end = jiffies + cfqd->cfq_slice_idle; 3320 cfqq->slice_end = jiffies + cfqd->cfq_slice_idle;
3309 cfq_mark_cfqq_wait_busy(cfqq); 3321 cfq_mark_cfqq_wait_busy(cfqq);
3322 cfq_log_cfqq(cfqd, cfqq, "will busy wait");
3310 } 3323 }
3311 3324
3312 /* 3325 /*