LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Xiaoming Ni <nixiaoming@huawei.com>
To: Waiman Long <llong@redhat.com>, <linux-kernel@vger.kernel.org>,
<peterz@infradead.org>, <mingo@redhat.com>, <will@kernel.org>,
<boqun.feng@gmail.com>
Cc: <wangle6@huawei.com>, <xiaoqian9@huawei.com>, <shaolexi@huawei.com>
Subject: Re: [PATCH] semaphore: Add might_sleep() to down_*() family
Date: Mon, 9 Aug 2021 22:33:18 +0800 [thread overview]
Message-ID: <2266017d-df76-1208-0e1f-0b066c788f66@huawei.com> (raw)
In-Reply-To: <65fe396a-b10d-2388-8229-05fd43d58927@redhat.com>
On 2021/8/9 20:52, Waiman Long wrote:
> 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.
>
If the code enters down_common(), it is not "might" sleep but "will"
sleep, and an alarm is printed in __schedule_bug() later.
"might_sleep()" is used to check potential problems, and
"_schedule_bug()" is used to check actual faults.
So, I still think we should add "might_sleep()" to each down_*()
function to alert code owner to potential problems early.
Thanks
Xiaoming Ni
next prev parent reply other threads:[~2021-08-09 14:36 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-09 2:12 Xiaoming Ni
2021-08-09 3:01 ` Waiman Long
2021-08-09 3:51 ` Xiaoming Ni
2021-08-09 12:52 ` Waiman Long
2021-08-09 14:33 ` Xiaoming Ni [this message]
2021-08-13 17:27 ` Thomas Gleixner
2021-08-13 18:47 ` Waiman Long
2021-08-13 14:43 ` Will Deacon
2021-08-23 9:39 ` [tip: locking/core] locking/semaphore: " tip-bot2 for Xiaoming Ni
2021-08-31 11:13 ` [PATCH] semaphore: " Guenter Roeck
2021-08-31 11:39 ` Hanjun Guo
2021-08-31 12:20 ` Thomas Gleixner
2021-08-31 11:40 ` Peter Zijlstra
2021-08-31 12:13 ` Thomas Gleixner
2021-08-31 12:34 ` Will Deacon
2021-08-31 17:42 ` Guenter Roeck
2021-09-01 8:37 ` [tip: smp/urgent] drivers: base: cacheinfo: Get rid of DEFINE_SMP_CALL_CACHE_FUNCTION() tip-bot2 for Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2266017d-df76-1208-0e1f-0b066c788f66@huawei.com \
--to=nixiaoming@huawei.com \
--cc=boqun.feng@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=llong@redhat.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=shaolexi@huawei.com \
--cc=wangle6@huawei.com \
--cc=will@kernel.org \
--cc=xiaoqian9@huawei.com \
--subject='Re: [PATCH] semaphore: Add might_sleep() to down_*() family' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).