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]
Date:	Thu, 20 May 2010 15:33:24 -0700
From:	Michel Lespinasse <walken@...gle.com>
To:	David Howells <dhowells@...hat.com>
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>,
	Ingo Molnar <mingo@...e.hu>,
	Thomas Gleixner <tglx@...utronix.de>,
	LKML <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Mike Waychison <mikew@...gle.com>,
	Suleiman Souhlal <suleiman@...gle.com>,
	Ying Han <yinghan@...gle.com>
Subject: Re: [PATCH 03/10] rwsem: lighter active count checks when waking up 
	readers

On Wed, May 19, 2010 at 5:25 AM, David Howells <dhowells@...hat.com> wrote:
> Michel Lespinasse <walken@...gle.com> wrote:
>
>> ... When there are waiter threads on a rwsem and the spinlock is held, other
>> threads can only increment the active count by trying to grab the rwsem in
>> up_xxxx().
>
> That's not true.  A thread attempting to get an rwsem by issuing a down_read()
> or down_write() will also unconditionally increment the active count before it
> considers calling out to the slow path.
>
> Maybe what you mean is that other threads wanting to do a wake up can only
> increase the active count for the processes being woken up whilst holding the
> rwsem's spinlock.

Damn, this was a pretty bad commit comment - I wrote up_xxxx instead
of down_xxxx here.

down_xxxx can increase the active count but it will then take the
down_failed path and wait to acquire the spinlock - so we don't need
to worry about it. Other code paths can't even increase the active
count, since they don't hold the spinlock.

(I got mixed up due to a legitimate mention of the up_xxxx path higher
up. Semaphore operation names confuse me with the active count going
up in down() and down in up() - I suppose it made more sense in the
era of mechanical train semaphores :)

>> +     /* If we come here from up_xxxx(), another thread might have reached
>> +      * rwsem_down_failed_common() before we acquired the spinlock and
>> +      * woken up an active locker.
>
> Do you mean a waiter rather than an active locker?  If a process is still
> registering activity on the rwsem, then it can't be woken yet.

Yes, I meant a waiter (but since it got woken it's now an active locker).

> Apart from that, the patch looks fine.  That's all comment/description fixes.

Thanks. Updated the comments. And I thought I could speak english... :)

-- 
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ