[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4D2AEF7E.8060901@cn.fujitsu.com>
Date: Mon, 10 Jan 2011 19:37:34 +0800
From: Lai Jiangshan <laijs@...fujitsu.com>
To: Steven Rostedt <rostedt@...dmis.org>
CC: Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...e.hu>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Andrew Morton <akpm@...ux-foundation.org>,
Dave Young <hidave.darkstar@...il.com>,
Darren Hart <dvhart@...ux.intel.com>,
Namhyung Kim <namhyung@...il.com>,
LKML <linux-kernel@...r.kernel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH] rtmutex: ensure only the top waiter or higher priority
task can take the lock and reduce unrelated boosting
On 01/06/2011 10:50 PM, Steven Rostedt wrote:
> On Wed, 2010-12-15 at 16:09 +0800, Lai Jiangshan wrote:
>
>> kernel/futex.c | 26 +---
>> kernel/rtmutex.c | 306 ++++++++++++++++--------------------------------
>> kernel/rtmutex_common.h | 16 --
>> 3 files changed, 116 insertions(+), 232 deletions(-)
>>
>> diff --git a/kernel/futex.c b/kernel/futex.c
>> index 6c683b3..5f4ea5f 100644
>> --- a/kernel/futex.c
>> +++ b/kernel/futex.c
>> @@ -775,18 +775,10 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this)
>> return -EINVAL;
>>
>> raw_spin_lock(&pi_state->pi_mutex.wait_lock);
>> + /* set new owner to the most possible owner(top waiter). */
>> new_owner = rt_mutex_next_owner(&pi_state->pi_mutex);
>>
>> /*
>> - * This happens when we have stolen the lock and the original
>> - * pending owner did not enqueue itself back on the rt_mutex.
>> - * Thats not a tragedy. We know that way, that a lock waiter
>> - * is on the fly. We make the futex_q waiter the pending owner.
>> - */
>> - if (!new_owner)
>> - new_owner = this->task;
>
> Lai,
>
> Why did you remove this? I just triggered a bug that was caused by
> rt_mutex_next_owner() returning NULL.
>
> Hmm, reading the comment it looks like it would only return NULL if the
> next owner woke up and removed itself (which it does not do anymore).
> But, this code is called unconditionally. I'm thinking we can trigger
> this if a timeout occurred too.
>
> I guess the real change should just be to the comment.
>
> I can add trace debug to see if that was indeed the case.
>
After this patch applied, the topwaiter will not be deququed when the lock
is released(any waiter is dequeued only when it really get the lock or give up).
So the wait list will not be empty if someone is still waiting on.
I thought, in this code, this->task is waiting, so rt_mutex_next_owner()
will not return NULL. As you found, my thought is wrong, we should just
change the comment.
Thanks,
Lai
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists