Commit f0245aac authored by Robert Love's avatar Robert Love Committed by Linus Torvalds

[PATCH] remove wq_lock_t cruft

This patch removes the whole wq_lock_t abstraction, forcing the behavior
to be that of a standard spinlock and changes all the wq_lock code in
the tree appropriately.

Removes lots of code - always a Good Thing to me.  New behavior is same
as previous behavior (USE_RW_WAIT_QUEUE_SPINLOCK unset).
parent 7723316a
...@@ -1152,9 +1152,9 @@ static int adpt_i2o_post_wait(adpt_hba* pHba, u32* msg, int len, int timeout) ...@@ -1152,9 +1152,9 @@ static int adpt_i2o_post_wait(adpt_hba* pHba, u32* msg, int len, int timeout)
// this code is taken from kernel/sched.c:interruptible_sleep_on_timeout // this code is taken from kernel/sched.c:interruptible_sleep_on_timeout
wait.task = current; wait.task = current;
init_waitqueue_entry(&wait, current); init_waitqueue_entry(&wait, current);
wq_write_lock_irqsave(&adpt_wq_i2o_post.lock,flags); spin_lock_irqsave(&adpt_wq_i2o_post.lock, flags);
__add_wait_queue(&adpt_wq_i2o_post, &wait); __add_wait_queue(&adpt_wq_i2o_post, &wait);
wq_write_unlock(&adpt_wq_i2o_post.lock); spin_unlock(&adpt_wq_i2o_post.lock);
msg[2] |= 0x80000000 | ((u32)wait_data->id); msg[2] |= 0x80000000 | ((u32)wait_data->id);
timeout *= HZ; timeout *= HZ;
...@@ -1167,9 +1167,9 @@ static int adpt_i2o_post_wait(adpt_hba* pHba, u32* msg, int len, int timeout) ...@@ -1167,9 +1167,9 @@ static int adpt_i2o_post_wait(adpt_hba* pHba, u32* msg, int len, int timeout)
schedule_timeout(timeout*HZ); schedule_timeout(timeout*HZ);
spin_lock_irq(pHba->host->host_lock); spin_lock_irq(pHba->host->host_lock);
} }
wq_write_lock_irq(&adpt_wq_i2o_post.lock); spin_lock_irq(&adpt_wq_i2o_post.lock);
__remove_wait_queue(&adpt_wq_i2o_post, &wait); __remove_wait_queue(&adpt_wq_i2o_post, &wait);
wq_write_unlock_irqrestore(&adpt_wq_i2o_post.lock,flags); spin_unlock_irqrestore(&adpt_wq_i2o_post.lock, flags);
if(status == -ETIMEDOUT){ if(status == -ETIMEDOUT){
printk(KERN_INFO"dpti%d: POST WAIT TIMEOUT\n",pHba->unit); printk(KERN_INFO"dpti%d: POST WAIT TIMEOUT\n",pHba->unit);
......
...@@ -27,42 +27,8 @@ struct __wait_queue { ...@@ -27,42 +27,8 @@ struct __wait_queue {
}; };
typedef struct __wait_queue wait_queue_t; typedef struct __wait_queue wait_queue_t;
/*
* 'dual' spinlock architecture. Can be switched between spinlock_t and
* rwlock_t locks via changing this define. Since waitqueues are quite
* decoupled in the new architecture, lightweight 'simple' spinlocks give
* us slightly better latencies and smaller waitqueue structure size.
*/
#define USE_RW_WAIT_QUEUE_SPINLOCK 0
#if USE_RW_WAIT_QUEUE_SPINLOCK
# define wq_lock_t rwlock_t
# define WAITQUEUE_RW_LOCK_UNLOCKED RW_LOCK_UNLOCKED
# define wq_read_lock read_lock
# define wq_read_lock_irqsave read_lock_irqsave
# define wq_read_unlock_irqrestore read_unlock_irqrestore
# define wq_read_unlock read_unlock
# define wq_write_lock_irq write_lock_irq
# define wq_write_lock_irqsave write_lock_irqsave
# define wq_write_unlock_irqrestore write_unlock_irqrestore
# define wq_write_unlock write_unlock
#else
# define wq_lock_t spinlock_t
# define WAITQUEUE_RW_LOCK_UNLOCKED SPIN_LOCK_UNLOCKED
# define wq_read_lock spin_lock
# define wq_read_lock_irqsave spin_lock_irqsave
# define wq_read_unlock spin_unlock
# define wq_read_unlock_irqrestore spin_unlock_irqrestore
# define wq_write_lock_irq spin_lock_irq
# define wq_write_lock_irqsave spin_lock_irqsave
# define wq_write_unlock_irqrestore spin_unlock_irqrestore
# define wq_write_unlock spin_unlock
#endif
struct __wait_queue_head { struct __wait_queue_head {
wq_lock_t lock; spinlock_t lock;
struct list_head task_list; struct list_head task_list;
}; };
typedef struct __wait_queue_head wait_queue_head_t; typedef struct __wait_queue_head wait_queue_head_t;
...@@ -80,7 +46,7 @@ typedef struct __wait_queue_head wait_queue_head_t; ...@@ -80,7 +46,7 @@ typedef struct __wait_queue_head wait_queue_head_t;
wait_queue_t name = __WAITQUEUE_INITIALIZER(name, tsk) wait_queue_t name = __WAITQUEUE_INITIALIZER(name, tsk)
#define __WAIT_QUEUE_HEAD_INITIALIZER(name) { \ #define __WAIT_QUEUE_HEAD_INITIALIZER(name) { \
lock: WAITQUEUE_RW_LOCK_UNLOCKED, \ lock: SPIN_LOCK_UNLOCKED, \
task_list: { &(name).task_list, &(name).task_list } } task_list: { &(name).task_list, &(name).task_list } }
#define DECLARE_WAIT_QUEUE_HEAD(name) \ #define DECLARE_WAIT_QUEUE_HEAD(name) \
...@@ -88,7 +54,7 @@ typedef struct __wait_queue_head wait_queue_head_t; ...@@ -88,7 +54,7 @@ typedef struct __wait_queue_head wait_queue_head_t;
static inline void init_waitqueue_head(wait_queue_head_t *q) static inline void init_waitqueue_head(wait_queue_head_t *q)
{ {
q->lock = WAITQUEUE_RW_LOCK_UNLOCKED; q->lock = SPIN_LOCK_UNLOCKED;
INIT_LIST_HEAD(&q->task_list); INIT_LIST_HEAD(&q->task_list);
} }
......
...@@ -53,9 +53,9 @@ void add_wait_queue(wait_queue_head_t *q, wait_queue_t * wait) ...@@ -53,9 +53,9 @@ void add_wait_queue(wait_queue_head_t *q, wait_queue_t * wait)
unsigned long flags; unsigned long flags;
wait->flags &= ~WQ_FLAG_EXCLUSIVE; wait->flags &= ~WQ_FLAG_EXCLUSIVE;
wq_write_lock_irqsave(&q->lock, flags); spin_lock_irqsave(&q->lock, flags);
__add_wait_queue(q, wait); __add_wait_queue(q, wait);
wq_write_unlock_irqrestore(&q->lock, flags); spin_unlock_irqrestore(&q->lock, flags);
} }
void add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t * wait) void add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t * wait)
...@@ -63,18 +63,18 @@ void add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t * wait) ...@@ -63,18 +63,18 @@ void add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t * wait)
unsigned long flags; unsigned long flags;
wait->flags |= WQ_FLAG_EXCLUSIVE; wait->flags |= WQ_FLAG_EXCLUSIVE;
wq_write_lock_irqsave(&q->lock, flags); spin_lock_irqsave(&q->lock, flags);
__add_wait_queue_tail(q, wait); __add_wait_queue_tail(q, wait);
wq_write_unlock_irqrestore(&q->lock, flags); spin_unlock_irqrestore(&q->lock, flags);
} }
void remove_wait_queue(wait_queue_head_t *q, wait_queue_t * wait) void remove_wait_queue(wait_queue_head_t *q, wait_queue_t * wait)
{ {
unsigned long flags; unsigned long flags;
wq_write_lock_irqsave(&q->lock, flags); spin_lock_irqsave(&q->lock, flags);
__remove_wait_queue(q, wait); __remove_wait_queue(q, wait);
wq_write_unlock_irqrestore(&q->lock, flags); spin_unlock_irqrestore(&q->lock, flags);
} }
void __init fork_init(unsigned long mempages) void __init fork_init(unsigned long mempages)
......
...@@ -903,9 +903,9 @@ void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr_exclusive) ...@@ -903,9 +903,9 @@ void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr_exclusive)
if (unlikely(!q)) if (unlikely(!q))
return; return;
wq_read_lock_irqsave(&q->lock, flags); spin_lock_irqsave(&q->lock, flags);
__wake_up_common(q, mode, nr_exclusive); __wake_up_common(q, mode, nr_exclusive);
wq_read_unlock_irqrestore(&q->lock, flags); spin_unlock_irqrestore(&q->lock, flags);
} }
void complete(struct completion *x) void complete(struct completion *x)
...@@ -944,14 +944,14 @@ void wait_for_completion(struct completion *x) ...@@ -944,14 +944,14 @@ void wait_for_completion(struct completion *x)
init_waitqueue_entry(&wait, current); init_waitqueue_entry(&wait, current);
#define SLEEP_ON_HEAD \ #define SLEEP_ON_HEAD \
wq_write_lock_irqsave(&q->lock,flags); \ spin_lock_irqsave(&q->lock,flags); \
__add_wait_queue(q, &wait); \ __add_wait_queue(q, &wait); \
wq_write_unlock(&q->lock); spin_unlock(&q->lock);
#define SLEEP_ON_TAIL \ #define SLEEP_ON_TAIL \
wq_write_lock_irq(&q->lock); \ spin_lock_irq(&q->lock); \
__remove_wait_queue(q, &wait); \ __remove_wait_queue(q, &wait); \
wq_write_unlock_irqrestore(&q->lock,flags); spin_unlock_irqrestore(&q->lock, flags);
void interruptible_sleep_on(wait_queue_head_t *q) void interruptible_sleep_on(wait_queue_head_t *q)
{ {
......
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