Re: [PATCH 1/3] rtmutex: comments update

From: Alex Shi
Date: Tue Apr 18 2017 - 04:40:01 EST




On 04/15/2017 02:43 AM, Steven Rostedt wrote:
>> Yes, how about this?
>> +If the G process has highest priority in the chain, any rightside lock owners
>> +in the tree branch need to increase its' priority as high as G.
>
> If task G is the highest priority task in the chain, then all the tasks
> up the chain (A and B in this example), must have their priorities
> increased to that of G.

Sounds better than mine. :)
>>
>> The schedule can then wake up for a couple of reasons:
>
> The task can then wake up for a couple of reasons:

fixed.
>
>> 1) The previous lock owner released the lock, and we are top_waiter now
>
> and the task is now the top_waiter

Yes.
>
>> 2) we received a signal or timeout
>>
>> For the first reason, we could get the lock in acquisition retry and back to
>> TASK_RUNNING state.
>
> Actually that's not quite true.
>
> In the first case, the task will try again to acquire the lock. If it
> does, then it will take itself off the waiters tree and set itself back
> to the TASK_RUNNING state. If the lock was acquired by another task
> before this task could get the lock, then it will go back to sleep and
> wait to be woken again.

Yes, your version includes the failure conditions in lock retrying. will
use yours explanation, thanks!

>
>> For the second reason, if task is in TASK_INTERRUPTIBLE
>> state, we will give up the lock acquisition, and also back to TASK_RUNNING.
>
> The second case is only applicable for tasks that are grabbing a mutex
> that can wake up before getting the lock, either due to a signal or
> a timeout (i.e. rt_mutex_timed_futex_lock()). When woken, it will try to
> take the lock again, if it succeeds, then the task will return with the
> lock held, otherwise it will return with -EINTR if the task was woken
> by a signal, or -ETIMEDOUT if it timed out.

Will use yours version too. Thanks a lot!
>
>> Otherwise we will yield cpu and back to sleep.
>
> Nuke the above sentence.

Drop this sentence.