diff options
| author | William Lee Irwin III <wli@holomorphy.com> | 2004-10-18 18:00:40 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-10-18 18:00:40 -0700 |
| commit | 9659cc899afad76f8d45e91e4ed244d65d95cf61 (patch) | |
| tree | 6031d97bd4f583afc8fa836ffbe3953ce619188d /kernel | |
| parent | bc341c61fe34e873446bea41beff938f5bee44f2 (diff) | |
[PATCH] reduce number of parameters to __wait_on_bit() and __wait_on_bit_lock()
Some of the parameters to __wait_on_bit() and __wait_on_bit_lock() are
redundant, as the wait_bit_queue parameter holds the flags word and the bit
number. This patch updates __wait_on_bit() and __wait_on_bit_lock() to
fetch that information from the wait_bit_queue passed to them and so reduce
the number of parameters so that -mregparm may be more effective.
Incremental atop the complete out-of-lining of the contention cases and the
fastcall and wait_on_bit_lock()/test_and_set_bit() fixes.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/wait.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/kernel/wait.c b/kernel/wait.c index ebb3da44dc12..1ca53daecd91 100644 --- a/kernel/wait.c +++ b/kernel/wait.c @@ -152,13 +152,15 @@ EXPORT_SYMBOL(wake_bit_function); */ int __sched fastcall __wait_on_bit(wait_queue_head_t *wq, struct wait_bit_queue *q, - void *word, int bit, int (*action)(void *), unsigned mode) + int (*action)(void *), unsigned mode) { int ret = 0; - prepare_to_wait(wq, &q->wait, mode); - if (test_bit(bit, word)) - ret = (*action)(word); + do { + prepare_to_wait(wq, &q->wait, mode); + if (test_bit(q->key.bit_nr, q->key.flags)) + ret = (*action)(q->key.flags); + } while (test_bit(q->key.bit_nr, q->key.flags) && !ret); finish_wait(wq, &q->wait); return ret; } @@ -170,23 +172,23 @@ int __sched fastcall out_of_line_wait_on_bit(void *word, int bit, wait_queue_head_t *wq = bit_waitqueue(word, bit); DEFINE_WAIT_BIT(wait, word, bit); - return __wait_on_bit(wq, &wait, word, bit, action, mode); + return __wait_on_bit(wq, &wait, action, mode); } EXPORT_SYMBOL(out_of_line_wait_on_bit); int __sched fastcall __wait_on_bit_lock(wait_queue_head_t *wq, struct wait_bit_queue *q, - void *word, int bit, int (*action)(void *), unsigned mode) + int (*action)(void *), unsigned mode) { int ret = 0; do { prepare_to_wait_exclusive(wq, &q->wait, mode); - if (test_bit(bit, word)) { - if ((ret = (*action)(word))) + if (test_bit(q->key.bit_nr, q->key.flags)) { + if ((ret = (*action)(q->key.flags))) break; } - } while (test_and_set_bit(bit, word)); + } while (test_and_set_bit(q->key.bit_nr, q->key.flags)); finish_wait(wq, &q->wait); return ret; } @@ -198,7 +200,7 @@ int __sched fastcall out_of_line_wait_on_bit_lock(void *word, int bit, wait_queue_head_t *wq = bit_waitqueue(word, bit); DEFINE_WAIT_BIT(wait, word, bit); - return __wait_on_bit_lock(wq, &wait, word, bit, action, mode); + return __wait_on_bit_lock(wq, &wait, action, mode); } EXPORT_SYMBOL(out_of_line_wait_on_bit_lock); |
