diff mbox

[1/3] Make rt_down_read_trylock() behave like down_read_trylock()

Message ID 20090407235902.196040156@suse.de (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Blunck April 7, 2009, 11:58 p.m. UTC
This patch removes the stupid "Read locks within the self-held write lock
succeed" behaviour. This is breaking in mm_take_all_locks() since it is quite
common to ensure that a lock is taken with BUG_ON(down_read_trylock(&mm->mmap_sem)).

Signed-off-by: Jan Blunck <jblunck@suse.de>
---
 kernel/rt.c |   12 ------------
 1 file changed, 12 deletions(-)



--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Thomas Gleixner April 9, 2009, 1:47 p.m. UTC | #1
On Wed, 8 Apr 2009, Jan Blunck wrote:

> This patch removes the stupid "Read locks within the self-held write lock
> succeed" behaviour. This is breaking in mm_take_all_locks() since it is quite
> common to ensure that a lock is taken with BUG_ON(down_read_trylock(&mm->mmap_sem)).

Good catch. There are some more oddballs in that file, which we missed
when we moved from 26 to 29 - we dropped the rwlocks stuff and that
cleaned up that area.

Thanks,

	tglx
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

Index: b/kernel/rt.c
===================================================================
--- a/kernel/rt.c
+++ b/kernel/rt.c
@@ -381,18 +381,6 @@  int  rt_down_read_trylock(struct rw_sema
 	unsigned long flags;
 	int ret;
 
-	/*
-	 * Read locks within the self-held write lock succeed.
-	 */
-	spin_lock_irqsave(&rwsem->lock.wait_lock, flags);
-	if (rt_mutex_real_owner(&rwsem->lock) == current) {
-		spin_unlock_irqrestore(&rwsem->lock.wait_lock, flags);
-		rwsem_acquire_read(&rwsem->dep_map, 0, 1, _RET_IP_);
-		rwsem->read_depth++;
-		return 1;
-	}
-	spin_unlock_irqrestore(&rwsem->lock.wait_lock, flags);
-
 	ret = rt_mutex_trylock(&rwsem->lock);
 	if (ret)
 		rwsem_acquire(&rwsem->dep_map, 0, 1, _RET_IP_);