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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191030193129.GA32308@hirez.programming.kicks-ass.net>
Date:   Wed, 30 Oct 2019 20:31:29 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Oleg Nesterov <oleg@...hat.com>
Cc:     Will Deacon <will.deacon@...nel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        linux-kernel@...r.kernel.org, bigeasy@...utronix.de,
        juri.lelli@...hat.com, williams@...hat.com, bristot@...hat.com,
        longman@...hat.com, dave@...olabs.net, jack@...e.com
Subject: Re: [PATCH] locking/percpu_rwsem: Rewrite to not use rwsem

On Wed, Oct 30, 2019 at 06:52:31PM +0100, Peter Zijlstra wrote:
> @@ -58,16 +72,17 @@ static inline void percpu_down_read(struct percpu_rw_semaphore *sem)
>  	preempt_enable();
>  }
>  
> -static inline int percpu_down_read_trylock(struct percpu_rw_semaphore *sem)
> +static inline bool percpu_down_read_trylock(struct percpu_rw_semaphore *sem)
>  {
> -	int ret = 1;
> +	bool ret = true;
>  
>  	preempt_disable();
>  	/*
>  	 * Same as in percpu_down_read().
>  	 */
> -	__this_cpu_inc(*sem->read_count);
> -	if (unlikely(!rcu_sync_is_idle(&sem->rss)))
> +	if (likely(!rcu_sync_is_idle(&sem->rss)))

That should obviously also loose the !

> +		__this_cpu_inc(*sem->read_count);
> +	else
>  		ret = __percpu_down_read(sem, true); /* Unconditional memory barrier */
>  	preempt_enable();
>  	/*

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ