hung_task: fix false positive during vfork
[linux-2.6.git] / kernel / rwsem.c
index 291ded5..9f48f3d 100644 (file)
@@ -6,21 +6,22 @@
 
 #include <linux/types.h>
 #include <linux/kernel.h>
+#include <linux/sched.h>
 #include <linux/module.h>
 #include <linux/rwsem.h>
 
 #include <asm/system.h>
-#include <asm/atomic.h>
+#include <linux/atomic.h>
 
 /*
  * lock for reading
  */
-void down_read(struct rw_semaphore *sem)
+void __sched down_read(struct rw_semaphore *sem)
 {
        might_sleep();
        rwsem_acquire_read(&sem->dep_map, 0, 0, _RET_IP_);
 
-       __down_read(sem);
+       LOCK_CONTENDED(sem, __down_read_trylock, __down_read);
 }
 
 EXPORT_SYMBOL(down_read);
@@ -42,12 +43,12 @@ EXPORT_SYMBOL(down_read_trylock);
 /*
  * lock for writing
  */
-void down_write(struct rw_semaphore *sem)
+void __sched down_write(struct rw_semaphore *sem)
 {
        might_sleep();
        rwsem_acquire(&sem->dep_map, 0, 0, _RET_IP_);
 
-       __down_write(sem);
+       LOCK_CONTENDED(sem, __down_write_trylock, __down_write);
 }
 
 EXPORT_SYMBOL(down_write);
@@ -60,7 +61,7 @@ int down_write_trylock(struct rw_semaphore *sem)
        int ret = __down_write_trylock(sem);
 
        if (ret == 1)
-               rwsem_acquire(&sem->dep_map, 0, 0, _RET_IP_);
+               rwsem_acquire(&sem->dep_map, 0, 1, _RET_IP_);
        return ret;
 }
 
@@ -111,37 +112,21 @@ void down_read_nested(struct rw_semaphore *sem, int subclass)
        might_sleep();
        rwsem_acquire_read(&sem->dep_map, subclass, 0, _RET_IP_);
 
-       __down_read(sem);
+       LOCK_CONTENDED(sem, __down_read_trylock, __down_read);
 }
 
 EXPORT_SYMBOL(down_read_nested);
 
-void down_read_non_owner(struct rw_semaphore *sem)
-{
-       might_sleep();
-
-       __down_read(sem);
-}
-
-EXPORT_SYMBOL(down_read_non_owner);
-
 void down_write_nested(struct rw_semaphore *sem, int subclass)
 {
        might_sleep();
        rwsem_acquire(&sem->dep_map, subclass, 0, _RET_IP_);
 
-       __down_write_nested(sem, subclass);
+       LOCK_CONTENDED(sem, __down_write_trylock, __down_write);
 }
 
 EXPORT_SYMBOL(down_write_nested);
 
-void up_read_non_owner(struct rw_semaphore *sem)
-{
-       __up_read(sem);
-}
-
-EXPORT_SYMBOL(up_read_non_owner);
-
 #endif