diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2008-01-24 02:44:49 -0500 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-01-28 04:50:33 -0500 |
commit | 4ac845a2e9a816ed5a7b301f56dcc0a3d0b1ba4d (patch) | |
tree | 602f15808d0f3dcdfcd7cc4491b2cc2ccd266fd2 /include/linux/iocontext.h | |
parent | 66dac98ed0de7a1125fb0dd7907f238f6b9d2f60 (diff) |
block: cfq: make the io contect sharing lockless
The io context sharing introduced a per-ioc spinlock, that would protect
the cfq io context lookup. That is a regression from the original, since
we never needed any locking there because the ioc/cic were process private.
The cic lookup is changed from an rbtree construct to a radix tree, which
we can then use RCU to make the reader side lockless. That is the performance
critical path, modifying the radix tree is only done on process creation
(when that process first does IO, actually) and on process exit (if that
process has done IO).
As it so happens, radix trees are also much faster for this type of
lookup where the key is a pointer. It's a very sparse tree.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'include/linux/iocontext.h')
-rw-r--r-- | include/linux/iocontext.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h index cd44d458124a..593b222d9dcc 100644 --- a/include/linux/iocontext.h +++ b/include/linux/iocontext.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef IOCONTEXT_H | 1 | #ifndef IOCONTEXT_H |
2 | #define IOCONTEXT_H | 2 | #define IOCONTEXT_H |
3 | 3 | ||
4 | #include <linux/radix-tree.h> | ||
5 | |||
4 | /* | 6 | /* |
5 | * This is the per-process anticipatory I/O scheduler state. | 7 | * This is the per-process anticipatory I/O scheduler state. |
6 | */ | 8 | */ |
@@ -29,8 +31,8 @@ struct as_io_context { | |||
29 | 31 | ||
30 | struct cfq_queue; | 32 | struct cfq_queue; |
31 | struct cfq_io_context { | 33 | struct cfq_io_context { |
32 | struct rb_node rb_node; | ||
33 | void *key; | 34 | void *key; |
35 | unsigned long dead_key; | ||
34 | 36 | ||
35 | struct cfq_queue *cfqq[2]; | 37 | struct cfq_queue *cfqq[2]; |
36 | 38 | ||
@@ -74,7 +76,7 @@ struct io_context { | |||
74 | int nr_batch_requests; /* Number of requests left in the batch */ | 76 | int nr_batch_requests; /* Number of requests left in the batch */ |
75 | 77 | ||
76 | struct as_io_context *aic; | 78 | struct as_io_context *aic; |
77 | struct rb_root cic_root; | 79 | struct radix_tree_root radix_root; |
78 | void *ioc_data; | 80 | void *ioc_data; |
79 | }; | 81 | }; |
80 | 82 | ||