Re: [PATCH 1/2] locking/mutex: remove rcu_read_lock/unlock as we already disabled preemption

From: Waiman Long
Date: Sun Sep 26 2021 - 15:17:13 EST


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.

Cheers,
Longman