Commit 2f7a2d89 authored by Shaohua Li's avatar Shaohua Li Committed by Jens Axboe

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: default avatarCorrado Zoccolo <czoccolo@gmail.com>
Signed-off-by: Shaohua Li<shaohua.li@intel.com>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent 6ec1480d
...@@ -1667,13 +1667,17 @@ static inline sector_t cfq_dist_from_last(struct cfq_data *cfqd, ...@@ -1667,13 +1667,17 @@ static inline sector_t cfq_dist_from_last(struct cfq_data *cfqd,
#define CFQQ_SEEKY(cfqq) ((cfqq)->seek_mean > CFQQ_SEEK_THR) #define CFQQ_SEEKY(cfqq) ((cfqq)->seek_mean > CFQQ_SEEK_THR)
static inline int cfq_rq_close(struct cfq_data *cfqd, struct cfq_queue *cfqq, static inline int cfq_rq_close(struct cfq_data *cfqd, struct cfq_queue *cfqq,
struct request *rq) struct request *rq, bool for_preempt)
{ {
sector_t sdist = cfqq->seek_mean; sector_t sdist = cfqq->seek_mean;
if (!sample_valid(cfqq->seek_samples)) if (!sample_valid(cfqq->seek_samples))
sdist = CFQQ_SEEK_THR; sdist = CFQQ_SEEK_THR;
/* if seek_mean is big, using it as close criteria is meaningless */
if (sdist > CFQQ_SEEK_THR && !for_preempt)
sdist = CFQQ_SEEK_THR;
return cfq_dist_from_last(cfqd, rq) <= sdist; return cfq_dist_from_last(cfqd, rq) <= sdist;
} }
...@@ -1701,7 +1705,7 @@ static struct cfq_queue *cfqq_close(struct cfq_data *cfqd, ...@@ -1701,7 +1705,7 @@ static struct cfq_queue *cfqq_close(struct cfq_data *cfqd,
* will contain the closest sector. * will contain the closest sector.
*/ */
__cfqq = rb_entry(parent, struct cfq_queue, p_node); __cfqq = rb_entry(parent, struct cfq_queue, p_node);
if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq)) if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq, false))
return __cfqq; return __cfqq;
if (blk_rq_pos(__cfqq->next_rq) < sector) if (blk_rq_pos(__cfqq->next_rq) < sector)
...@@ -1712,7 +1716,7 @@ static struct cfq_queue *cfqq_close(struct cfq_data *cfqd, ...@@ -1712,7 +1716,7 @@ static struct cfq_queue *cfqq_close(struct cfq_data *cfqd,
return NULL; return NULL;
__cfqq = rb_entry(node, struct cfq_queue, p_node); __cfqq = rb_entry(node, struct cfq_queue, p_node);
if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq)) if (cfq_rq_close(cfqd, cur_cfqq, __cfqq->next_rq, false))
return __cfqq; return __cfqq;
return NULL; return NULL;
...@@ -3112,7 +3116,7 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq, ...@@ -3112,7 +3116,7 @@ cfq_should_preempt(struct cfq_data *cfqd, struct cfq_queue *new_cfqq,
* if this request is as-good as one we would expect from the * if this request is as-good as one we would expect from the
* current cfqq, let it preempt * current cfqq, let it preempt
*/ */
if (cfq_rq_close(cfqd, cfqq, rq)) if (cfq_rq_close(cfqd, cfqq, rq, true))
return true; return true;
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment