mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
aio: make the lookup_ioctx() lockless
The mm->ioctx_list is currently protected by a reader-writer lock, so we always grab that lock on the read side for doing ioctx lookups. As the workload is extremely reader biased, turn this into an rcu hlist so we can make lookup_ioctx() lockless. Get rid of the rwlock and use a spinlock for providing update side exclusion. There's usually only 1 entry on this list, so it doesn't make sense to look into fancier data structures. Reviewed-by: Jeff Moyer <jmoyer@redhat.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
This commit is contained in:
parent
392ddc3298
commit
abf137dd77
5 changed files with 71 additions and 55 deletions
|
@ -5,6 +5,7 @@
|
|||
#include <linux/workqueue.h>
|
||||
#include <linux/aio_abi.h>
|
||||
#include <linux/uio.h>
|
||||
#include <linux/rcupdate.h>
|
||||
|
||||
#include <asm/atomic.h>
|
||||
|
||||
|
@ -183,7 +184,7 @@ struct kioctx {
|
|||
|
||||
/* This needs improving */
|
||||
unsigned long user_id;
|
||||
struct kioctx *next;
|
||||
struct hlist_node list;
|
||||
|
||||
wait_queue_head_t wait;
|
||||
|
||||
|
@ -199,6 +200,8 @@ struct kioctx {
|
|||
struct aio_ring_info ring_info;
|
||||
|
||||
struct delayed_work wq;
|
||||
|
||||
struct rcu_head rcu_head;
|
||||
};
|
||||
|
||||
/* prototypes */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue