Commit 3fddff46 authored by Jens Axboe's avatar Jens Axboe

[PATCH] arrange request fiels sanely

Right now, various fields in struct request are just scattered
throughout the struct. This makes for bad cache behaviour. This patch
puts commonly referenced together fiels in the same cache lines and also
removes the prefetches in deadline_merge(). The latter was actually
hurting performance here now that struct request is sanely laid out wrt
cache.

This is worth ~40% less deadline_merge() runtime during disk intensive
tests!
parent 1273c16c
......@@ -118,7 +118,6 @@ deadline_find_hash(struct deadline_data *dd, sector_t offset)
while ((entry = next) != hash_list) {
next = entry->next;
prefetch(next);
drq = list_entry_hash(entry);
......@@ -193,8 +192,6 @@ deadline_merge(request_queue_t *q, struct list_head **insert, struct bio *bio)
while ((entry = entry->prev) != sort_list) {
__rq = list_entry_rq(entry);
prefetch(entry->prev);
BUG_ON(__rq->flags & REQ_STARTED);
if (!(__rq->flags & REQ_CMD))
......@@ -302,8 +299,6 @@ static void deadline_move_requests(struct deadline_data *dd, struct request *rq)
struct list_head *nxt = rq->queuelist.next;
int this_rq_cost;
prefetch(nxt);
/*
* take it off the sort and fifo list, move
* to dispatch queue
......
......@@ -22,30 +22,35 @@ struct request_list {
wait_queue_head_t wait;
};
/*
* try to put the fields that are referenced together in the same cacheline
*/
struct request {
struct list_head queuelist; /* looking for ->queue? you must _not_
* access it directly, use
* blkdev_dequeue_request! */
int ref_count;
void *elevator_private;
unsigned long flags; /* see REQ_ bits below */
unsigned char cmd[16];
kdev_t rq_dev;
sector_t sector;
unsigned long nr_sectors;
unsigned int current_nr_sectors;
unsigned long flags; /* see REQ_ bits below */
void *elevator_private;
int rq_status; /* should split this into a few status bits */
kdev_t rq_dev;
struct gendisk *rq_disk;
int errors;
sector_t sector;
unsigned long start_time;
unsigned long nr_sectors;
sector_t hard_sector; /* the hard_* are block layer
* internals, no driver should
* touch them
*/
unsigned long hard_nr_sectors;
unsigned int hard_cur_sectors;
struct bio *bio;
struct bio *biotail;
/* Number of scatter-gather DMA addr+len pairs after
* physical address coalescing is performed.
......@@ -59,13 +64,21 @@ struct request {
*/
unsigned short nr_hw_segments;
unsigned int current_nr_sectors;
unsigned int hard_cur_sectors;
int tag;
void *special;
char *buffer;
/* For packet commands */
int ref_count;
request_queue_t *q;
struct request_list *rl;
struct completion *waiting;
void *special;
/*
* when request is used as a packet command carrier
*/
unsigned char cmd[16];
unsigned int data_len;
void *data;
......@@ -73,10 +86,6 @@ struct request {
void *sense;
unsigned int timeout;
struct completion *waiting;
struct bio *bio, *biotail;
request_queue_t *q;
struct request_list *rl;
};
/*
......
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