summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2003-08-29 10:23:42 +1000
committerAnton Blanchard <anton@samba.org>2003-08-29 10:23:42 +1000
commite5122ad463da0d880e104341c7828b43526d9624 (patch)
treedade213b2345d65e9c1ca751f3eee58f58330610 /arch
parent64553593bc1bb5803f121c2cedece686f5804730 (diff)
ppc64: semaphore fixes based on report by ever watchful Olaf Hering
Diffstat (limited to 'arch')
-rw-r--r--arch/ppc64/kernel/semaphore.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/arch/ppc64/kernel/semaphore.c b/arch/ppc64/kernel/semaphore.c
index 7fb2d8d95d0a..c977029e2465 100644
--- a/arch/ppc64/kernel/semaphore.c
+++ b/arch/ppc64/kernel/semaphore.c
@@ -75,9 +75,8 @@ void __down(struct semaphore *sem)
struct task_struct *tsk = current;
DECLARE_WAITQUEUE(wait, tsk);
- tsk->state = TASK_UNINTERRUPTIBLE;
+ __set_task_state(tsk, TASK_UNINTERRUPTIBLE);
add_wait_queue_exclusive(&sem->wait, &wait);
- smp_wmb();
/*
* Try to get the semaphore. If the count is > 0, then we've
@@ -87,10 +86,10 @@ void __down(struct semaphore *sem)
*/
while (__sem_update_count(sem, -1) <= 0) {
schedule();
- tsk->state = TASK_UNINTERRUPTIBLE;
+ set_task_state(tsk, TASK_UNINTERRUPTIBLE);
}
remove_wait_queue(&sem->wait, &wait);
- tsk->state = TASK_RUNNING;
+ __set_task_state(tsk, TASK_RUNNING);
/*
* If there are any more sleepers, wake one of them up so
@@ -106,9 +105,8 @@ int __down_interruptible(struct semaphore * sem)
struct task_struct *tsk = current;
DECLARE_WAITQUEUE(wait, tsk);
- tsk->state = TASK_INTERRUPTIBLE;
+ __set_task_state(tsk, TASK_INTERRUPTIBLE);
add_wait_queue_exclusive(&sem->wait, &wait);
- smp_wmb();
while (__sem_update_count(sem, -1) <= 0) {
if (signal_pending(current)) {
@@ -122,10 +120,11 @@ int __down_interruptible(struct semaphore * sem)
break;
}
schedule();
- tsk->state = TASK_INTERRUPTIBLE;
+ set_task_state(tsk, TASK_INTERRUPTIBLE);
}
- tsk->state = TASK_RUNNING;
remove_wait_queue(&sem->wait, &wait);
+ __set_task_state(tsk, TASK_RUNNING);
+
wake_up(&sem->wait);
return retval;
}