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: <234a49df-0f88-2dc1-968c-8bfe52ccf9d4@redhat.com>
Date:   Tue, 8 Dec 2020 10:29:39 -0500
From:   Waiman Long <longman@...hat.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
        linux-kernel@...r.kernel.org, Davidlohr Bueso <dave@...olabs.net>,
        Phil Auld <pauld@...hat.com>
Subject: Re: [PATCH v2 5/5] locking/rwsem: Remove reader optimistic spinning

On 12/8/20 5:07 AM, Peter Zijlstra wrote:
> On Fri, Nov 20, 2020 at 11:14:16PM -0500, Waiman Long wrote:
>
>
>> @@ -1032,40 +901,16 @@ rwsem_down_read_slowpath(struct rw_semaphore *sem, int state, long count)
>>   	 *
>>   	 * We can take the read lock directly without doing
>>   	 * rwsem_optimistic_spin() if the conditions are right.
> This comment no longer makes sense..

You are right. I forgot to take that out.


>> -	 * Also wake up other readers if it is the first reader.
>>   	 */
>> -	if (!(count & (RWSEM_WRITER_LOCKED | RWSEM_FLAG_HANDOFF)) &&
>> -	    rwsem_no_spinners(sem)) {
>> +	if (!(count & (RWSEM_WRITER_LOCKED | RWSEM_FLAG_HANDOFF))) {
>>   		rwsem_set_reader_owned(sem);
>>   		lockevent_inc(rwsem_rlock_steal);
>> -		if (rcnt == 1)
>> -			goto wake_readers;
>> -		return sem;
>> -	}
>>   
>> -	/*
>> -	 * Save the current read-owner of rwsem, if available, and the
>> -	 * reader nonspinnable bit.
>> -	 */
>> -	waiter.last_rowner = owner;
>> -	if (!(waiter.last_rowner & RWSEM_READER_OWNED))
>> -		waiter.last_rowner &= RWSEM_RD_NONSPINNABLE;
>> -
>> -	if (!rwsem_can_spin_on_owner(sem, RWSEM_RD_NONSPINNABLE))
>> -		goto queue;
>> -
>> -	/*
>> -	 * Undo read bias from down_read() and do optimistic spinning.
>> -	 */
>> -	atomic_long_add(-RWSEM_READER_BIAS, &sem->count);
>> -	adjustment = 0;
>> -	if (rwsem_optimistic_spin(sem, false)) {
> since we're removing the optimistic spinning entirely on the read side.
>
> Also, I was looking at skipping patch #4, which mucks with the reader
> wakeup logic, and afaict this removal doesn't really depend on it.
>
> Or am I missing something?

That is true. Patch 4 isn't essential for this series. So if you are 
general OK with the current patchset, I can send out v3 that remove 
patch 4 and make the your suggested change above.

Cheers,
Longman

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ