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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.1210251204140.23712@file.rdu.redhat.com>
Date:	Thu, 25 Oct 2012 12:15:26 -0400 (EDT)
From:	Mikulas Patocka <mpatocka@...hat.com>
To:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
cc:	Linus Torvalds <torvalds@...ux-foundation.org>,
	Oleg Nesterov <oleg@...hat.com>, Ingo Molnar <mingo@...e.hu>,
	Peter Zijlstra <peterz@...radead.org>,
	Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
	Ananth N Mavinakayanahalli <ananth@...ibm.com>,
	Anton Arapov <anton@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] percpu-rw-semaphores: use rcu_read_lock_sched



On Thu, 25 Oct 2012, Paul E. McKenney wrote:

> On Thu, Oct 25, 2012 at 10:54:11AM -0400, Mikulas Patocka wrote:
> > 
> > 
> > On Wed, 24 Oct 2012, Paul E. McKenney wrote:
> > 
> > > On Mon, Oct 22, 2012 at 07:39:16PM -0400, Mikulas Patocka wrote:
> > > > Use rcu_read_lock_sched / rcu_read_unlock_sched / synchronize_sched
> > > > instead of rcu_read_lock / rcu_read_unlock / synchronize_rcu.
> > > > 
> > > > This is an optimization. The RCU-protected region is very small, so
> > > > there will be no latency problems if we disable preempt in this region.
> > > > 
> > > > So we use rcu_read_lock_sched / rcu_read_unlock_sched that translates
> > > > to preempt_disable / preempt_disable. It is smaller (and supposedly
> > > > faster) than preemptible rcu_read_lock / rcu_read_unlock.
> > > > 
> > > > Signed-off-by: Mikulas Patocka <mpatocka@...hat.com>
> > > 
> > > OK, as promised/threatened, I finally got a chance to take a closer look.
> > > 
> > > The light_mb() and heavy_mb() definitions aren't doing much for me,
> > > the code would be cleared with them expanded inline.  And while the
> > > approach of pairing barrier() with synchronize_sched() is interesting,
> > > it would be simpler to rely on RCU's properties.  The key point is that
> > > if RCU cannot prove that a given RCU-sched read-side critical section
> > > is seen by all CPUs to have started after a given synchronize_sched(),
> > > then that synchronize_sched() must wait for that RCU-sched read-side
> > > critical section to complete.
> > 
> > Also note that you can define both light_mb() and heavy_mb() to be 
> > smp_mb() and slow down the reader path a bit and speed up the writer path.
> > 
> > On architectures with in-order memory access (and thus smp_mb() equals 
> > barrier()), it doesn't hurt the reader but helps the writer, for example:
> > #ifdef ARCH_HAS_INORDER_MEMORY_ACCESS
> > #define light_mb()      smp_mb()
> > #define heavy_mb()      smp_mb()
> > #else
> > #define light_mb()      barrier()
> > #define heavy_mb()      synchronize_sched()
> > #endif
> 
> Except that there are no systems running Linux with in-order memory
> access.  Even x86 and s390 require a barrier instruction for smp_mb()
> on SMP=y builds.
> 
> 							Thanx, Paul

PA-RISC is in-order. But it is used very rarely.

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