Commit 0975ab2a authored by Jens Axboe's avatar Jens Axboe Committed by Linus Torvalds

[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.
parent c6d738b8
...@@ -28,7 +28,7 @@ static int writes_starved = 2; /* max times reads can starve a write */ ...@@ -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 static int fifo_batch = 16; /* # of sequential requests treated as one
by the above parameters. For throughput. */ 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_BLOCK(sec) ((sec) >> 3)
#define DL_HASH_FN(sec) (hash_long(DL_HASH_BLOCK((sec)), deadline_hash_shift)) #define DL_HASH_FN(sec) (hash_long(DL_HASH_BLOCK((sec)), deadline_hash_shift))
#define DL_HASH_ENTRIES (1 << 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) ...@@ -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))]); 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 * static struct request *
deadline_find_drq_hash(struct deadline_data *dd, sector_t offset) 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) ...@@ -353,6 +368,8 @@ deadline_merge(request_queue_t *q, struct list_head **insert, struct bio *bio)
out: out:
q->last_merge = &__rq->queuelist; q->last_merge = &__rq->queuelist;
out_insert: out_insert:
if (ret)
deadline_hot_drq_hash(dd, RQ_DATA(__rq));
*insert = &__rq->queuelist; *insert = &__rq->queuelist;
return ret; return ret;
} }
......
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