From: "Xu, Yanfei" <yanfei.xu@windriver.com>
To: Waiman Long <llong@redhat.com>,
peterz@infradead.org, mingo@redhat.com, will@kernel.org,
boqun.feng@gmail.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] locking/mutex: remove rcu_read_lock/unlock as we already disabled preemption
Date: Mon, 27 Sep 2021 17:28:47 +0800 [thread overview]
Message-ID: <0222bc32-9807-8bd4-bd76-dbc62f512435@windriver.com> (raw)
In-Reply-To: <70424003-1b4a-bb92-1123-7820d6321717@redhat.com>
On 9/27/21 8:46 AM, Waiman Long wrote:
> [Please note: This e-mail is from an EXTERNAL e-mail address]
>
> On 9/26/21 3:16 PM, Waiman Long wrote:
>> On 9/26/21 6:16 AM, Yanfei Xu wrote:
>>> preempt_disable/enable() is equal to RCU read-side crital section,
>>> and the mutex lock slowpath disable the preemption throughout the
>>> entire slowpath. Let's remove the rcu_read_lock/unlock for saving
>>> some cycles in hot codes.
>>
>> The description is wrong. Preemption is disabled only in the
>> optimistic spinning code which is not the complete slowpath. Even
>> though it may sound reasonable that disable preemption is likely to
>> prevent reaching quiescent state, but I am not totally sure that will
>> always be the case as there are different RCU favors.
>
> It does look like that disable preemption can serve as a substitute for
> rcu_read_lock(). However, I will suggest that you also insert a comment
> saying so and the task structure won't go away during the spinning period.
>
Will send v2, thanks.
Yanfei
> Cheers,
> Longman
>
prev parent reply other threads:[~2021-09-27 9:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-26 10:16 Yanfei Xu
2021-09-26 10:16 ` [PATCH 2/2] locking/rwsem: Use rcu_read_lock_sched to simplify codes Yanfei Xu
2021-09-26 19:22 ` Waiman Long
2021-09-27 16:41 ` Xu, Yanfei
2021-09-26 19:16 ` [PATCH 1/2] locking/mutex: remove rcu_read_lock/unlock as we already disabled preemption Waiman Long
2021-09-27 0:46 ` Waiman Long
2021-09-27 9:28 ` Xu, Yanfei [this message]
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=0222bc32-9807-8bd4-bd76-dbc62f512435@windriver.com \
--to=yanfei.xu@windriver.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=will@kernel.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®