[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <65fe396a-b10d-2388-8229-05fd43d58927@redhat.com>
Date: Mon, 9 Aug 2021 08:52:48 -0400
From: Waiman Long <llong@...hat.com>
To: Xiaoming Ni <nixiaoming@...wei.com>,
Waiman Long <llong@...hat.com>, linux-kernel@...r.kernel.org,
peterz@...radead.org, mingo@...hat.com, will@...nel.org,
boqun.feng@...il.com
Cc: wangle6@...wei.com, xiaoqian9@...wei.com, shaolexi@...wei.com
Subject: Re: [PATCH] semaphore: Add might_sleep() to down_*() family
On 8/8/21 11:51 PM, Xiaoming Ni wrote:
> On 2021/8/9 11:01, Waiman Long wrote:
>>
>> I think it is simpler to just put a "might_sleep()" in
>> __down_common() which is the function where sleep can actually happen.
>>
>
> If the actual atomic context hibernation occurs, the corresponding
> alarm log is generated in __schedule_bug().
> __schedule()
> --> schedule_debug()
> --> __schedule_bug()
>
> However, "might_sleep()" indicates the possibility of sleep, so that
> code writers can identify and fix the problem as soon as possible, but
> does not trigger atomic context sleep.
>
> Is it better to put "might_sleep()" in each down API entry than
> __down_common() to help identify potential code problems?
Putting "might_sleep()" in each down_*() functions mean that whenever we
add a new API function, we have to remember to add "might_sleep()". If
we put it in down_common(), it will work for any newly added API
function in the future even though I doubt we will add any.
Cheers,
Longman
Powered by blists - more mailing lists