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] [day] [month] [year] [list]
Message-ID: <572A405F.6000401@hpe.com>
Date:	Wed, 4 May 2016 14:33:03 -0400
From:	Waiman Long <waiman.long@....com>
To:	Jason Low <jason.low2@...com>
CC:	Davidlohr Bueso <dave@...olabs.net>,
	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...hat.com>, <linux-kernel@...r.kernel.org>,
	Scott J Norton <scott.norton@....com>,
	Douglas Hatch <doug.hatch@....com>, <jason.low2@....com>
Subject: Re: [PATCH] locking/rwsem: Add reader owned state to the owner field

On 05/04/2016 01:52 PM, Jason Low wrote:
> On Wed, 2016-05-04 at 13:27 -0400, Waiman Long wrote:
>> On 05/03/2016 08:21 PM, Davidlohr Bueso wrote:
>>> On Wed, 27 Apr 2016, Waiman Long wrote:
>>>> static bool rwsem_optimistic_spin(struct rw_semaphore *sem)
>>>> @@ -378,7 +367,8 @@ static bool rwsem_optimistic_spin(struct
>>>> rw_semaphore *sem)
>>>>
>>>>      while (true) {
>>>>          owner = READ_ONCE(sem->owner);
>>>> -        if (owner&&  !rwsem_spin_on_owner(sem, owner))
>>>> +        if (rwsem_is_writer_owned(owner)&&
>>>> +           !rwsem_spin_on_owner(sem, owner))
>>>>              break;
>>>>
>>>>          /* wait_lock will be acquired if write_lock is obtained */
>>>> @@ -391,9 +381,11 @@ static bool rwsem_optimistic_spin(struct
>>>> rw_semaphore *sem)
>>>>           * When there's no owner, we might have preempted between the
>>>>           * owner acquiring the lock and setting the owner field. If
>>>>           * we're an RT task that will live-lock because we won't let
>>>> -         * the owner complete.
>>>> +         * the owner complete. We also quit if the lock is owned by
>>>> +         * readers.
>>>>           */
>>>> -        if (!owner&&  (need_resched() || rt_task(current)))
>>>> +        if ((owner == RWSEM_READER_OWNED) ||
> It would be good to provide and use a rwsem_is_reader_owned() function
> like we do with rwsem_is_writer_owned(), especially if we're going to
> add in the additional cast.
>

Yes, sure I can certainly add the rwsem_is_reader_owned() helper function.

Cheers,
Longman

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ