diff options
| author | Jens Axboe <axboe@suse.de> | 2003-05-10 08:05:49 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2003-05-10 08:05:49 -0700 |
| commit | 0975ab2aa71b367f9d32ee5822a6a67090cca7e0 (patch) | |
| tree | db2cc43bb157559562b4661aa242e2cc4992cdf1 /drivers/block | |
| parent | c6d738b86b33d75697c102ecc215c14268069b3f (diff) | |
[PATCH] shrink deadline hash size
Limit deadline hash to 32 entries instead of 1024. This has been benched
and profiled extensively and shows no increased system time.
Also, move "hot" entries to the front of the list.
Diffstat (limited to 'drivers/block')
| -rw-r--r-- | drivers/block/deadline-iosched.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/block/deadline-iosched.c b/drivers/block/deadline-iosched.c index 6735d56e2264..e85b7f09aef0 100644 --- a/drivers/block/deadline-iosched.c +++ b/drivers/block/deadline-iosched.c @@ -28,7 +28,7 @@ static int writes_starved = 2; /* max times reads can starve a write */ static int fifo_batch = 16; /* # of sequential requests treated as one by the above parameters. For throughput. */ -static const int deadline_hash_shift = 10; +static const int deadline_hash_shift = 5; #define DL_HASH_BLOCK(sec) ((sec) >> 3) #define DL_HASH_FN(sec) (hash_long(DL_HASH_BLOCK((sec)), deadline_hash_shift)) #define DL_HASH_ENTRIES (1 << deadline_hash_shift) @@ -130,6 +130,21 @@ deadline_add_drq_hash(struct deadline_data *dd, struct deadline_rq *drq) list_add(&drq->hash, &dd->hash[DL_HASH_FN(rq_hash_key(rq))]); } +/* + * move hot entry to front of chain + */ +static inline void +deadline_hot_drq_hash(struct deadline_data *dd, struct deadline_rq *drq) +{ + struct request *rq = drq->request; + struct list_head *head = &dd->hash[DL_HASH_FN(rq_hash_key(rq))]; + + if (ON_HASH(drq) && drq->hash.prev != head) { + list_del(&drq->hash); + list_add(&drq->hash, head); + } +} + static struct request * deadline_find_drq_hash(struct deadline_data *dd, sector_t offset) { @@ -353,6 +368,8 @@ deadline_merge(request_queue_t *q, struct list_head **insert, struct bio *bio) out: q->last_merge = &__rq->queuelist; out_insert: + if (ret) + deadline_hot_drq_hash(dd, RQ_DATA(__rq)); *insert = &__rq->queuelist; return ret; } |
