diff options
author | Shaohua Li <shaohua.li@intel.com> | 2009-12-28 07:18:44 -0500 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-12-28 07:18:44 -0500 |
commit | 2f7a2d89a8b5915d89ad9ebeb0065db7d5831cea (patch) | |
tree | 776c4a7e47b07437c30411d7324b5a1c7de01696 /block | |
parent | 6ec1480d8539c8e2e6ba7fbbeffe5adc640bfe98 (diff) |
cfq-iosched: don't regard requests with long distance as close
seek_mean could be very big sometimes, using it as close criteria is meaningless
as this doen't improve any performance. So if it's big, let's fallback to
default value.
Reviewed-by: Corrado Zoccolo <czoccolo@gmail.com>
Signed-off-by: Shaohua Li<shaohua.li@intel.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/cfq-iosched.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 8df4fe58f4e..918c7fd9aeb 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -1667,13 +1667,17 @@ static inline sector_t cfq_dist_from_last(struct cfq_data *cfqd, | |||
1667 | #define CFQQ_SEEKY(cfqq) ((cfqq)->seek_mean > CFQQ_SEEK_THR) | 1667 | #define CFQQ_SEEKY(cfqq) ((cfqq)->seek_mean > CFQQ_SEEK_THR) |
1668 | 1668 | ||
1669 | static inline int cfq_rq_close(struct cfq_data *cfqd, struct cfq_queue *cfqq, | 1669 | static inline int cfq_rq_close(struct cfq_data *cfqd, struct cfq_queue *cfqq, |
1670 | struct request *rq) | 1670 | struct request *rq, bool for_preempt) |
1671 | { | 1671 | { |
1672 | sector_t sdist = cfqq->seek_mean; | 1672 | sector_t sdist = cfqq->seek_mean; |
1673 | 1673 | ||
1674 | if (!sample_valid(cfqq->seek_samples)) | 1674 | if (!sample_valid(cfqq->seek_samples)) |
1675 | sdist = CFQQ_SEEK_THR; | 1675 | sdist = CFQQ_SEEK_THR; |
1676 | 1676 | ||
1677 | /* if seek_mean is big, using it as close criteria is meaningless */ | ||
1678 | if (sdist > CFQQ_SEEK_THR && !for_preempt) | ||
1679 | sdist = CFQQ_SEEK_THR; | ||
1680 | |||
1677 | return cfq_dist_from_last(cfqd, rq) <= sdist; | 1681 | return cfq_dist_from_last(cfqd, rq) <= sdist; |
1678 | } | 1682 | } |
1679 | 1683 | ||
@@ -1701,7 +1705,7 @@ static struct cfq_queue *cfqq_close(struct cfq_data *cfqd, | |||
1701 | * will contain the closest sector. | 1705 | * will contain the closest sector. |
1702 | */ | 1706 | */ |
1703 | __cfqq = rb_entry(parent, struct cfq_queue, p_node); | 1707 | __cfqq = rb_entry(parent, struct cfq_queue, p_node); |
1704 | if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq)) | 1708 | if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq, false)) |
1705 | return __cfqq; | 1709 | return __cfqq; |
1706 | 1710 | ||
1707 | if (blk_rq_pos(__cfqq->next_rq) < sector) | 1711 | if (blk_rq_pos(__cfqq->next_rq) < sector) |
@@ -1712,7 +1716,7 @@ static struct cfq_queue *cfqq_close(struct cfq_data *cfqd, | |||
1712 | return NULL; | 1716 | return NULL; |
1713 | 1717 | ||
1714 | __cfqq = rb_entry(node, struct cfq_queue, p_node); | 1718 | __cfqq = rb_entry(node, struct cfq_queue, p_node); |
1715 | if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq)) | 1719 | if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq, false)) |
1716 | return __cfqq; | 1720 | return __cfqq; |
1717 | 1721 | ||
1718 | return NULL; | 1722 | return NULL; |
@@ -3112,7 +3116,7 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq, | |||
3112 | * if this request is as-good as one we would expect from the | 3116 | * if this request is as-good as one we would expect from the |
3113 | * current cfqq, let it preempt | 3117 | * current cfqq, let it preempt |
3114 | */ | 3118 | */ |
3115 | if (cfq_rq_close(cfqd, cfqq, rq)) | 3119 | if (cfq_rq_close(cfqd, cfqq, rq, true)) |
3116 | return true; | 3120 | return true; |
3117 | 3121 | ||
3118 | return false; | 3122 | return false; |