From 4ac845a2e9a816ed5a7b301f56dcc0a3d0b1ba4d Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 24 Jan 2008 08:44:49 +0100 Subject: 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 --- include/linux/iocontext.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include/linux') 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 @@ #ifndef IOCONTEXT_H #define IOCONTEXT_H +#include + /* * This is the per-process anticipatory I/O scheduler state. */ @@ -29,8 +31,8 @@ struct as_io_context { struct cfq_queue; struct cfq_io_context { - struct rb_node rb_node; void *key; + unsigned long dead_key; struct cfq_queue *cfqq[2]; @@ -74,7 +76,7 @@ struct io_context { int nr_batch_requests; /* Number of requests left in the batch */ struct as_io_context *aic; - struct rb_root cic_root; + struct radix_tree_root radix_root; void *ioc_data; }; -- cgit v1.2.3-59-g8ed1b