lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YWWKhoRzUWoMsJbk@hirez.programming.kicks-ass.net>
Date:   Tue, 12 Oct 2021 15:15:50 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Yanfei Xu <yanfei.xu@...driver.com>
Cc:     mingo@...hat.com, will@...nel.org, longman@...hat.com,
        boqun.feng@...il.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] locking/mutex: remove rcu_read_lock/unlock as we
 already disabled preemption

On Fri, Oct 08, 2021 at 11:25:18AM +0800, Yanfei Xu wrote:
> preempt_disable/enable() is equal to RCU read-side crital section,
> and the mutex lock slowpath disabled the preemption for the optimistic
> spinning code. Let's remove the rcu_read_lock/unlock for saving some 
> cycles in hot codes.
> 
> Signed-off-by: Yanfei Xu <yanfei.xu@...driver.com>
> ---
> v1->v2: fix the incorrect comment in code and commit message. 
>         thanks for WaiMan's suggestion.
> 
> BTW, sorry for this late v2 due to a long vocation.
> 
>  kernel/locking/mutex.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
> index 2fede72b6af5..2f654cfb10d9 100644
> --- a/kernel/locking/mutex.c
> +++ b/kernel/locking/mutex.c
> @@ -351,13 +351,14 @@ bool mutex_spin_on_owner(struct mutex *lock, struct task_struct *owner,
>  {
>  	bool ret = true;

	lockdep_assert_preemption_disabled();

> -	rcu_read_lock();
>  	while (__mutex_owner(lock) == owner) {
>  		/*
>  		 * Ensure we emit the owner->on_cpu, dereference _after_

And did you check the other code in locking/ for similar things?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ