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, 31 Jan 2013 14:10:32 +0100
From:	Ingo Molnar <mingo@...nel.org>
To:	Michel Lespinasse <walken@...gle.com>
Cc:	Yuanhan Liu <yuanhan.liu@...ux.intel.com>,
	linux-kernel@...r.kernel.org, David Howells <dhowells@...hat.com>
Subject: Re: [PATCH] rwsem-spinlock: let rwsem write lock stealable


* Michel Lespinasse <walken@...gle.com> wrote:

> On Wed, Jan 30, 2013 at 1:14 AM, Yuanhan Liu
> <yuanhan.liu@...ux.intel.com> wrote:
> > We(Linux Kernel Performance project) found a regression introduced by
> > commit 5a50508, which just convert all mutex lock to rwsem write lock.
> > The semantics is same, but the results is quite huge in some cases.
> > After investigation, we found the root cause: mutex support lock
> > stealing. Here is the link for the detailed regression report:
> >     https://lkml.org/lkml/2013/1/29/84
> >
> > Ingo suggests to add write lock stealing to rwsem as well:
> >     "I think we should allow lock-steal between rwsem writers - that
> >      will not hurt fairness as most rwsem fairness concerns relate to
> >      reader vs. writer fairness"
> >
> > I then tried it with rwsem-spinlock first as I found it much easier to
> > implement it than lib/rwsem.c. And here I sent out this patch first for
> > comments. I'd try lib/rwsem.c later once the change to rwsem-spinlock
> > is OK to you guys.
> 
> I noticed that you haven't modified __down_write_trylock() - for
> consistency with __down_write() you should replace
>         if (sem->activity == 0 && list_empty(&sem->wait_list)) {
> with
>         if (sem->activity == 0) {
> 
> Other than that, I like the idea. I was originally 
> uncomfortable with doing lock stealing for the rwsem, but I 
> think doing it for writers only as you propose should be fine. 
> Readers wait for any queued writers, and in exchange they are 
> guaranteed to get the lock once they've blocked. You *still* 
> want to check for regressions that this change might cause - 
> not with anon_vma as this was a mutex not long ago, but 
> possibly with mmap_sem - but I'm crossing my fingers and 
> thinking that it'll most likely turn out fine.

My gut feeling, from having implemented lock stealing in a 
number of locking primitives in the past, is that writer 
lock-stealing will be a measurable win for mmap_sem as well.

Thanks,

	Ingo
--
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