Re: [PATCH 1/4] sched: Add CPU rate soft caps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As pointed out by Con Kolivas there is an error in the mutex count part of this code and an opportunity to increase efficiency with use of the likely() macro. The attached patch addresses these issues.

Signed-off-by: Peter Williams <[email protected]>

--
Peter Williams                                   [email protected]

"Learning, n. The kind of ignorance distinguishing the studious."
 -- Ambrose Bierce
---
 kernel/mutex.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: MM-2.6.17-rc6-mm2/kernel/mutex.c
===================================================================
--- MM-2.6.17-rc6-mm2.orig/kernel/mutex.c	2006-06-19 09:57:03.000000000 +1000
+++ MM-2.6.17-rc6-mm2/kernel/mutex.c	2006-06-19 09:57:55.000000000 +1000
@@ -319,7 +319,7 @@ int fastcall __sched mutex_lock_interrup
 	ret = __mutex_fastpath_lock_retval
 			(&lock->count, __mutex_lock_interruptible_slowpath);
 
-	if (!ret)
+	if (likely(!ret))
 		inc_mutex_count();
 
 	return ret;
@@ -380,7 +380,7 @@ int fastcall __sched mutex_trylock(struc
 	int ret = __mutex_fastpath_trylock(&lock->count,
 					__mutex_trylock_slowpath);
 
-	if (!ret)
+	if (likely(ret))
 		inc_mutex_count();
 
 	return ret;

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux