lkml.org 
[lkml]   [2008]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [(RT RFC) PATCH v2 2/9] sysctl for runtime-control of lateral mutex stealing
Hi!

> From: Sven-Thorsten Dietrich <sdietrich@suse.de>
>
> Add /proc/sys/kernel/lateral_steal, to allow switching on and off
> equal-priority mutex stealing between threads.
>
> Signed-off-by: Sven-Thorsten Dietrich <sdietrich@suse.de>
> ---
>
> kernel/rtmutex.c | 7 ++++++-
> kernel/sysctl.c | 14 ++++++++++++++
> 2 files changed, 20 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
> index 6624c66..cd39c26 100644
> --- a/kernel/rtmutex.c
> +++ b/kernel/rtmutex.c
> @@ -18,6 +18,10 @@
>
> #include "rtmutex_common.h"
>
> +#ifdef CONFIG_RTLOCK_LATERAL_STEAL
> +int rtmutex_lateral_steal __read_mostly = 1;
> +#endif
> +

Ugly..


> /*
> * lock->owner state tracking:
> *
> @@ -321,7 +325,8 @@ static inline int lock_is_stealable(struct task_struct *pendowner, int unfair)
> if (current->prio > pendowner->prio)
> return 0;
>
> - if (!unfair && (current->prio == pendowner->prio))
> + if (unlikely(current->prio == pendowner->prio) &&
> + !(unfair && rtmutex_lateral_steal))
> #endif

But this is even worse, you are creating #ifdef maze here. Can you
simply #define rtmutex_lateral_steal 0 in !CONFIG_RTLOCK_LATERAL_STEAL
and let the optimizer fix this?


> index c913d48..c24c53d 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -175,6 +175,10 @@ extern struct ctl_table inotify_table[];
> int sysctl_legacy_va_layout;
> #endif
>
> +#ifdef CONFIG_RTLOCK_LATERAL_STEAL
> +extern int rtmutex_lateral_steal;
> +#endif
> +

Try checkpatch.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


\
 
 \ /
  Last update: 2008-02-25 22:55    [from the cache]
©2003-2011 Jasper Spaans