lkml.org 
[lkml]   [2006]   [Jun]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 1/4] sched: Add CPU rate soft caps
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 <pwil3058@bigpond.net.au>

--
Peter Williams pwil3058@bigpond.net.au

"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;
\
 
 \ /
  Last update: 2006-06-19 03:24    [W:0.162 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site