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: <20190416161727.GS14281@hirez.programming.kicks-ass.net>
Date:   Tue, 16 Apr 2019 18:17:27 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Waiman Long <longman@...hat.com>
Cc:     Ingo Molnar <mingo@...hat.com>, Will Deacon <will.deacon@....com>,
        Thomas Gleixner <tglx@...utronix.de>,
        linux-kernel@...r.kernel.org, x86@...nel.org,
        Davidlohr Bueso <dave@...olabs.net>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Tim Chen <tim.c.chen@...ux.intel.com>,
        huang ying <huang.ying.caritas@...il.com>
Subject: Re: [PATCH v4 06/16] locking/rwsem: Code cleanup after files merging

On Tue, Apr 16, 2019 at 06:01:13PM +0200, Peter Zijlstra wrote:
> @@ -794,34 +770,38 @@ static inline int __down_read_trylock(st
>   */
>  static inline void __down_write(struct rw_semaphore *sem)
>  {
> -	if (unlikely(atomic_long_cmpxchg_acquire(&sem->count, 0,
> -						 RWSEM_WRITER_LOCKED)))
> -		rwsem_down_write_failed(sem);
> +	long tmp = RWSEM_UNLOCKED_VALUE;
> +
> +	if (unlikely(atomic_long_try_cmpxchg_acquire(&sem->count, &tmp,
> +						     RWSEM_WRITER_LOCKED)))

!

> +		rwsem_down_write_slow(sem, TASK_UNINTERRUPTIBLE);
>  	rwsem_set_owner(sem);
>  }
>  
>  static inline int __down_write_killable(struct rw_semaphore *sem)
>  {
> -	if (unlikely(atomic_long_cmpxchg_acquire(&sem->count, 0,
> -						 RWSEM_WRITER_LOCKED)))
> -		if (IS_ERR(rwsem_down_write_failed_killable(sem)))
> +	long tmp = RWSEM_UNLOCKED_VALUE;
> +
> +	if (unlikely(atomic_long_try_cmpxchg_acquire(&sem->count, &tmp,
> +						     RWSEM_WRITER_LOCKED))) {

also !

> +		if (IS_ERR(rwsem_down_write_slow(sem, TASK_KILLABLE)))
>  			return -EINTR;
> +	}
>  	rwsem_set_owner(sem);
>  	return 0;
>  }

I'm having a great day it seems, it's like back in uni, trying to find
all the missing - signs in this page-long DE.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ