diff options
| author | Andrew Morton <akpm@osdl.org> | 2003-09-03 11:12:43 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.osdl.org> | 2003-09-03 11:12:43 -0700 |
| commit | 5eebb6f205162c0a7b0075e8d86453f81994aa2f (patch) | |
| tree | 439671fe1bdc0c1a80ceab3bf8bfdab36792821c /include/asm-alpha | |
| parent | 55308a20138c3ea39a0882265f255c5b0f931f20 (diff) | |
[PATCH] might_sleep() improvements
From: Mitchell Blank Jr <mitch@sfgoth.com>
This patch makes the following improvements to might_sleep():
o Add a "might_sleep_if()" macro for when we might sleep only if some
condition is met. It's a bit tidier, and has an unlikely() in it.
o Add might_sleep checks to skb_share_check() and skb_unshare() which
sometimes need to allocate memory.
o Make all architectures call might_sleep() in both down() and
down_interruptible(). Before only ppc, ppc64, and i386 did this check.
(sh did the check on down() but not down_interruptible())
Diffstat (limited to 'include/asm-alpha')
| -rw-r--r-- | include/asm-alpha/semaphore.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/include/asm-alpha/semaphore.h b/include/asm-alpha/semaphore.h index ab26cfbaddbf..a363f018a35f 100644 --- a/include/asm-alpha/semaphore.h +++ b/include/asm-alpha/semaphore.h @@ -88,14 +88,18 @@ extern void __up_wakeup(struct semaphore *); static inline void __down(struct semaphore *sem) { - long count = atomic_dec_return(&sem->count); + long count; + might_sleep(); + count = atomic_dec_return(&sem->count); if (unlikely(count < 0)) __down_failed(sem); } static inline int __down_interruptible(struct semaphore *sem) { - long count = atomic_dec_return(&sem->count); + long count; + might_sleep(); + count = atomic_dec_return(&sem->count); if (unlikely(count < 0)) return __down_failed_interruptible(sem); return 0; |
