lkml.org 
[lkml]   [2019]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.

\
 
 \ /
  Last update: 2019-04-16 18:18    [W:0.221 / U:0.500 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site