From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756120AbdDRIjx (ORCPT ); Tue, 18 Apr 2017 04:39:53 -0400 Received: from mail-pg0-f49.google.com ([74.125.83.49]:36796 "EHLO mail-pg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755818AbdDRIih (ORCPT ); Tue, 18 Apr 2017 04:38:37 -0400 Subject: Re: [PATCH 1/3] rtmutex: comments update To: Steven Rostedt References: <1492092174-31734-1-git-send-email-alex.shi@linaro.org> <1492092174-31734-2-git-send-email-alex.shi@linaro.org> <20170413115430.05a94664@gandalf.local.home> <6479bc7a-f491-ddca-fc51-a8c928c61992@linaro.org> <20170414144330.67a9a2ea@gandalf.local.home> Cc: peterz@infradead.org, mingo@redhat.com, corbet@lwn.net, "open list:LOCKING PRIMITIVES" , "open list:DOCUMENTATION" , Sebastian Siewior , Thomas Gleixner From: Alex Shi Message-ID: <22a06728-7bdc-6b96-ce5a-f97cfdd0b4c3@linaro.org> Date: Tue, 18 Apr 2017 16:38:17 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <20170414144330.67a9a2ea@gandalf.local.home> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.