Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 189635
b: refs/heads/master
c: 3eac4ab
h: refs/heads/master
i:
  189633: 1502943
  189631: 772f4b2
v: v3
  • Loading branch information
Kevin Hilman authored and Linus Torvalds committed Apr 7, 2010
1 parent 6348218 commit 1c3fab0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 04287f975e68038051eb9c79896866d36610b8e0
refs/heads/master: 3eac4abaa69949af0e2f64e5c55ee8a22bbdd3e7
14 changes: 8 additions & 6 deletions trunk/lib/rwsem-spinlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,14 @@ void __sched __down_read(struct rw_semaphore *sem)
{
struct rwsem_waiter waiter;
struct task_struct *tsk;
unsigned long flags;

spin_lock_irq(&sem->wait_lock);
spin_lock_irqsave(&sem->wait_lock, flags);

if (sem->activity >= 0 && list_empty(&sem->wait_list)) {
/* granted */
sem->activity++;
spin_unlock_irq(&sem->wait_lock);
spin_unlock_irqrestore(&sem->wait_lock, flags);
goto out;
}

Expand All @@ -164,7 +165,7 @@ void __sched __down_read(struct rw_semaphore *sem)
list_add_tail(&waiter.list, &sem->wait_list);

/* we don't need to touch the semaphore struct anymore */
spin_unlock_irq(&sem->wait_lock);
spin_unlock_irqrestore(&sem->wait_lock, flags);

/* wait to be given the lock */
for (;;) {
Expand Down Expand Up @@ -209,13 +210,14 @@ void __sched __down_write_nested(struct rw_semaphore *sem, int subclass)
{
struct rwsem_waiter waiter;
struct task_struct *tsk;
unsigned long flags;

spin_lock_irq(&sem->wait_lock);
spin_lock_irqsave(&sem->wait_lock, flags);

if (sem->activity == 0 && list_empty(&sem->wait_list)) {
/* granted */
sem->activity = -1;
spin_unlock_irq(&sem->wait_lock);
spin_unlock_irqrestore(&sem->wait_lock, flags);
goto out;
}

Expand All @@ -230,7 +232,7 @@ void __sched __down_write_nested(struct rw_semaphore *sem, int subclass)
list_add_tail(&waiter.list, &sem->wait_list);

/* we don't need to touch the semaphore struct anymore */
spin_unlock_irq(&sem->wait_lock);
spin_unlock_irqrestore(&sem->wait_lock, flags);

/* wait to be given the lock */
for (;;) {
Expand Down

0 comments on commit 1c3fab0

Please sign in to comment.