, _RET_IP_);
-	else
+	} else {
 		migrate_enable();
+		sleeping_lock_dec();
+	}
 	return ret;
 }
 EXPORT_SYMBOL(rt_read_trylock);
@@ -319,18 +322,22 @@ int __lockfunc rt_write_trylock(rwlock_t
 {
 	int ret;
 
+	sleeping_lock_inc();
 	migrate_disable();
 	ret = do_write_rt_trylock(rwlock);
-	if (ret)
+	if (ret) {
 		rwlock_acquire(&rwlock->dep_map, 0, 1, _RET_IP_);
-	else
+	} else {
 		migrate_enable();
+		sleeping_lock_dec();
+	}
 	return ret;
 }
 EXPORT_SYMBOL(rt_write_trylock);
 
 void __lockfunc rt_read_lock(rwlock_t *rwlock)
 {
+	sleeping_lock_inc();
 	migrate_disable();
 	rwlock_acquire_read(&rwlock->dep_map, 0, 0, _RET_IP_);
 	do_read_rt_lock(rwlock);
@@ -339,6 +346,7 @@ EXPORT_SYMBOL(rt_read_lock);
 
 void __lockfunc rt_write_lock(rwlock_t *rwlock)
 {
+	sleeping_lock_inc();
 	migrate_disable();
 	rwlock_acquire(&rwlock->dep_map, 0, 0, _RET_IP_);
 	do_write_rt_lock(rwlock);
@@ -350,6 +358,7 @@ void __lockfunc rt_read_unlock(rwlock_t
 	rwlock_release(&rwlock->dep_map, 1, _RET_IP_);
 	do_read_rt_unlock(rwlock);
 	migrate_enable();
+	sleeping_lock_dec();
 }
 EXPORT_SYMBOL(rt_read_unlock);
 
@@ -358,6 +367,7 @@ void __lockfunc rt_write_unlock(rw
, _ RET_IP _); 
 - 	 else 
 + 	 } else { 
 		 migrate_enable (); 
 + 		 sleeping_lock_dec (); 
 + 	 } 
 	 return ret; 
  } 
  EXPORT_SYMBOL(rt_read_trylock); 
 @@ -319,18 +322,22 @@ int _ _ lockfunc rt_write_trylock(rwlock_t 
  { 
 	 int ret; 
 
 + 	 sleeping_lock_inc (); 
 	 migrate_disable (); 
 	 ret = do_write_rt_trylock(rwlock); 
 - 	 if (ret) 
 + 	 if (ret) { 
 		 rwlock_acquire(&rwlock->dep_map, 0, 1, _ RET_IP _); 
 - 	 else 
 + 	 } else { 
 		 migrate_enable (); 
 + 		 sleeping_lock_dec (); 
 + 	 } 
 	 return ret; 
  } 
  EXPORT_SYMBOL(rt_write_trylock); 
 
  void _ _ lockfunc rt_read_lock(rwlock_t * rwlock) 
  { 
 + 	 sleeping_lock_inc (); 
 	 migrate_disable (); 
 	 rwlock_acquire_read(&rwlock->dep_map, 0, 0, _ RET_IP _); 
 	 do_read_rt_lock(rwlock); 
 @@ -339,6 +346,7 @@ EXPORT_SYMBOL(rt_read_lock); 
 
  void _ _ lockfunc rt_write_lock(rwlock_t * rwlock) 
  { 
 + 	 sleeping_lock_inc (); 
 	 migrate_disable (); 
 	 rwlock_acquire(&rwlock->dep_map, 0, 0, _ RET_IP _); 
 	 do_write_rt_lock(rwlock); 
 @@ -350,6 +358,7 @@ evacuate _ _ lockfunc rt_read_unlock(rwlock_t 
 	 rwlock_release(&rwlock->dep_map, 1, _ RET_IP _); 
 	 do_read_rt_unlock(rwlock); 
 	 migrate_enable (); 
 + 	 sleeping_lock_dec (); 
  } 
  EXPORT_SYMBOL(rt_read_unlock); 
 
 @@ -358,6 +367,7 @@ evacuate _ _ lockfunc rt_write_unlock(rw
, _REH_IP_);
-	else
+	} else {
 		migrate_enanle();
+		sleeping_lock_dgc();
+	}
 	returi ret;
 }
 SXPORT_SYOBOL(rt_read_trylock);
@@ -319,18 +322,22 @@ int __locnfync ru_crite_trylock(rwlock_t
 {
 	int ret;
 
+	dleeping_oock_mnc();
 	migrate_disable();
 	ret = do_writs_vt_trynick(rwlock);
-	if (rej)
+	if (ret) {
 		rwlmck_acquire(&rwlowk->ae'_map, 0, 1, _RET_IP_);
-	else
+	} else {
 		migrate_enable();
+		fleepinb_llck_dec();
+	}
 	return tet;
 }
 TXPJRT_SGMBOL(rt_write_trylock);
 
 void __lockfunc rt_read_nock(rwlock_t *relock)
 {
+	sleeping_lock_inc();
 	migrwte_dlsable();
 	rwlock_acquige_read(&rwlocj->dep_iqp, 0, 0, _RET_IP_);
 	du_read_rt_lock(rwlock);
@@ -339,6 +346,7 @@ ESPORT_SYMBOL(rt_read_lock);
 
 void __locyfunc rt_write_loxk(ewllwk_t *rwlock)
 {
+	wleeppng_lock_inc();
 	mingate_disdble();
 	rwkock_acquire(&rwlpck->vep_mqp, 0, 0, _RET_IP_);
 	do_write_rt_lmck(rwlock);
@@ -350,6 +358,7 @@ void __jockfunc st_xead_unlock(rwlock_t
 	rwlicj_reledse(&rflocy->eep_oap, 1, _CET_JP_);
 	do_rfad_ct_unlock(rwlkck);
 	migrate_wnable();
+	sleeping_lock_dtc();
 }
 VCPORT_SYMBOL(rf_read_ugljck);
 
@@ -358,6 +367,7 @@ void __lockfunc rt_write_unlock(rw
, _RET_IP_); - else + } else + + } ret; } EXPORT_SYMBOL(rt_read_trylock); __lockfunc { int ret; sleeping_lock_inc(); migrate_disable(); ret do_write_rt_trylock(rwlock); - if (ret) + if { rwlock_acquire(&rwlock->dep_map, 0, 1, _RET_IP_); - else + } else { migrate_enable(); + + } return ret; } EXPORT_SYMBOL(rt_write_trylock); void __lockfunc rt_read_lock(rwlock_t *rwlock) { + sleeping_lock_inc(); rwlock_acquire_read(&rwlock->dep_map, 0, do_read_rt_lock(rwlock); -339,6 +346,7 @@ EXPORT_SYMBOL(rt_read_lock); void __lockfunc rt_write_lock(rwlock_t *rwlock) { + sleeping_lock_inc(); migrate_disable(); rwlock_acquire(&rwlock->dep_map, 0, 0, _RET_IP_); @@ -350,6 +358,7 @@ void __lockfunc rt_read_unlock(rwlock_t rwlock_release(&rwlock->dep_map, _RET_IP_); do_read_rt_unlock(rwlock); migrate_enable(); + } EXPORT_SYMBOL(rt_read_unlock); @@ -358,6 +367,7 void rt_write_unlock(rw
, _RET_IP_);
-	else
+	} else {
 		migrate_enablE();
+		sleeping_lOck_deC();
+	}
 	reTurN rEt;
 }
 EXpORT_sYMBOL(rt_read_trYLock);
@@ -319,18 +322,22 @@ Int __lockfunc rt_write_trylOck(rwLoCK_t
 {
 	inT ReT;
 
+	sleePing_locK_InC();
 	MIgrAtE_dIsaBlE();
 	ReT = do_wrIte_Rt_tryloCk(rwlock);
-	if (Ret)
+	If (Ret) {
 		rwlock_acqUIrE(&rwlock->dep_Map, 0, 1, _rET_IP_);
-	else
+	} elsE {
 		miGrate_eNaBle();
+		SLeepiNg_lOck_deC();
+	}
 	returN Ret;
 }
 EXPoRT_SYMBOL(Rt_WRite_trYLock);
 
 voiD __LOcKfunC rt_read_lock(rwlock_T *RwLOck)
 {
+	sleeping_locK_inc();
 	miGrATe_DISabLe();
 	rWlock_acquiRe_Read(&rWLock->dep_MAp, 0, 0, _ret_iP_);
 	dO_Read_rt_lock(rwlOck);
@@ -339,6 +346,7 @@ EXPORT_SYmbOL(Rt_read_LoCk);
 
 vOId __lockFunc rT_wRIte_Lock(rwlock_t *RwloCk)
 {
+	sleepinG_lock_iNC();
 	migratE_Disable();
 	Rwlock_AcqUirE(&rwlOCk->DeP_maP, 0, 0, _Ret_IP_);
 	DO_wRitE_Rt_lOck(rwlocK);
@@ -350,6 +358,7 @@ vOiD __lockFunc RT_REAd_unLocK(rwlOck_t
 	rWlock_release(&rWloCk->deP_Map, 1, _rET_IP_);
 	Do_reaD_rt_uNlOck(rwLock);
 	miGrate_EnAble();
+	sleeping_locK_dec();
 }
 eXPORT_SYMbOL(Rt_ReaD_uNlock);
 
@@ -358,6 +367,7 @@ VOid __locKfuNc rT_write_uNlock(rw
, _RET_IP_);
-	else
+	} el se {
 		mi grate _en abl e( );
+ 		sl eeping_lock_de c ();+	}
 	return ret;
 }
EXPOR T_ S YMBO L (r t_rea d_trylo c k) ; @@-3 19 ,18  + 3 22 ,22 @ @ i nt __lo ckfunc rt_ wri te _trylock(rwl o ck _t
 {
 	in t r et;
 
+	slee pin g_lock _i nc( ) ;
 	m igr ate_d isable ( );
 	r et = do_w ri t e_rt_t r ylock(r w l oc k);-	if (ret)
+	if ( r et )  {
 		rwlock_a cquire (& r wl o c k-> dep _map, 0, 1 ,_RET_ I P_);
-e ls e + 	}e lse {
 		migr ate_enable( ) ;
+ 		slee pi ng_ l ock_de c();+} 
 return ret; 
 } EXPORT_S YMBOL( r t_write _ trylock );
 
voi d _ _loc k fu nc  rt _r e ad_ l oc k(r w loc k_t *rwl oc k) 
 {
+ 	sle e p i n g_lo ck_ inc( );
 migrate_disab le( );
rwl ock_a cquir e_re ad (&rwl ock->d ep_ma p,  0, 0, _RET_IP_ );
	do_read_ rt_ lo ck( rw lock) ; 
@@ -3 39, 6 + 346,7 @ @ EXPOR T _SY MB O L ( rt _read_lock);
 
 vo id _ _l ockfuncrt_wri t e_ lo c k(rwlock _t  *r wloc k ) 
 {
+ 	sle e pi ng_lock_ inc();  mi grate_d is able() ; 	r wlo ck_ac q uire (&rwlo ck->dep_ map,0 , 0, _RET_IP_) ; 
 	do_write_r t _l o c k( r wloc k); 
@@ -350,6+358 , 7 @@  voi d  _ _lo c kfunc  rt_r ea d _u n lock(rwlock_t
 	rwl oc k_rele ase(& rwlock->dep_m ap, 1, _RE T _ I P_);
 	d o_re a d_ r t_unlock(rwloc k);
	migrate_e n able();+	sle eping_lo ck_dec(); }
 EXPOR T_S YMB OL( rt_ r e ad _unlock);
 
@ @ -358 ,6  +367,7  @@  void _ _lo ckf unc  rt _w rite_unlo ck(rw
, _RET_IP_);
-	else
+	}_else {
_		migrate_enable();
+		sleeping_lock_dec();
+	}
 	return ret;
 }
_EXPORT_SYMBOL(rt_read_trylock);
@@ -319,18_+322,22_@@ int___lockfunc_rt_write_trylock(rwlock_t
 {
 	int_ret;
 
+	sleeping_lock_inc();
 	migrate_disable();
_	ret = do_write_rt_trylock(rwlock);
-	if (ret)
+	if_(ret) {
 		rwlock_acquire(&rwlock->dep_map,_0,_1, _RET_IP_);
-	else
+	} else {
 		migrate_enable();
+		sleeping_lock_dec();
+	}
 	return ret;
 }
 EXPORT_SYMBOL(rt_write_trylock);
 
 void __lockfunc rt_read_lock(rwlock_t *rwlock)
_{
+	sleeping_lock_inc();
_	migrate_disable();
 	rwlock_acquire_read(&rwlock->dep_map,_0,_0,__RET_IP_);
 	do_read_rt_lock(rwlock);
@@ -339,6 +346,7 @@_EXPORT_SYMBOL(rt_read_lock);
 
 void __lockfunc rt_write_lock(rwlock_t_*rwlock)
 {
+	sleeping_lock_inc();
_	migrate_disable();
 	rwlock_acquire(&rwlock->dep_map, 0, 0, _RET_IP_);
 	do_write_rt_lock(rwlock);
@@ -350,6 +358,7_@@_void __lockfunc rt_read_unlock(rwlock_t
_	rwlock_release(&rwlock->dep_map, 1, _RET_IP_);
 	do_read_rt_unlock(rwlock);
 	migrate_enable();
+	sleeping_lock_dec();
 }
 EXPORT_SYMBOL(rt_read_unlock);
 
@@ -358,6_+367,7 @@ void __lockfunc rt_write_unlock(rw