Re: [RFC PATCH 1/1] rcu: use atomic_read(v) instead of atomic_add_return(0, v)

2014-07-16 Thread Pranith Kumar
On 07/16/2014 09:14 AM, Paul E. McKenney wrote: > On Mon, Jul 14, 2014 at 09:27:00AM -0400, Pranith Kumar wrote: >> On Sat, Jul 12, 2014 at 8:08 AM, Paul E. McKenney wrote: >>> >>> They ensure that any RCU read-side critical sections that took place before >>> the current (or previous)

Re: [RFC PATCH 1/1] rcu: use atomic_read(v) instead of atomic_add_return(0, v)

2014-07-16 Thread Paul E. McKenney
On Mon, Jul 14, 2014 at 09:27:00AM -0400, Pranith Kumar wrote: > On Sat, Jul 12, 2014 at 8:08 AM, Paul E. McKenney wrote: > > > > They ensure that any RCU read-side critical sections that took place before > > the current (or previous) idle/userspace period on the remote CPU in > > question are

Re: [RFC PATCH 1/1] rcu: use atomic_read(v) instead of atomic_add_return(0, v)

2014-07-16 Thread Paul E. McKenney
On Mon, Jul 14, 2014 at 09:27:00AM -0400, Pranith Kumar wrote: On Sat, Jul 12, 2014 at 8:08 AM, Paul E. McKenney wrote: They ensure that any RCU read-side critical sections that took place before the current (or previous) idle/userspace period on the remote CPU in question are seen as

Re: [RFC PATCH 1/1] rcu: use atomic_read(v) instead of atomic_add_return(0, v)

2014-07-16 Thread Pranith Kumar
On 07/16/2014 09:14 AM, Paul E. McKenney wrote: On Mon, Jul 14, 2014 at 09:27:00AM -0400, Pranith Kumar wrote: On Sat, Jul 12, 2014 at 8:08 AM, Paul E. McKenney wrote: They ensure that any RCU read-side critical sections that took place before the current (or previous) idle/userspace period

Re: [RFC PATCH 1/1] rcu: use atomic_read(v) instead of atomic_add_return(0, v)

2014-07-14 Thread Pranith Kumar
On Sat, Jul 12, 2014 at 8:08 AM, Paul E. McKenney wrote: > > They ensure that any RCU read-side critical sections that took place before > the current (or previous) idle/userspace period on the remote CPU in > question are seen as having completed before the completion of the current > grace

Re: [RFC PATCH 1/1] rcu: use atomic_read(v) instead of atomic_add_return(0, v)

2014-07-14 Thread Pranith Kumar
On Sat, Jul 12, 2014 at 8:08 AM, Paul E. McKenney wrote: They ensure that any RCU read-side critical sections that took place before the current (or previous) idle/userspace period on the remote CPU in question are seen as having completed before the completion of the current grace period.

Re: [RFC PATCH 1/1] rcu: use atomic_read(v) instead of atomic_add_return(0, v)

2014-07-12 Thread Paul E. McKenney
On Fri, Jul 11, 2014 at 06:32:17PM -0400, Pranith Kumar wrote: > On Fri, Jul 11, 2014 at 5:43 AM, Paul E. McKenney wrote: > > On Thu, Jul 10, 2014 at 09:17:33PM -0400, Pranith Kumar wrote: > >> On Wed, Jul 9, 2014 at 3:56 PM, Paul E. McKenney > >> wrote: > >> > >> > OK, so ->dynticks_snap is

Re: [RFC PATCH 1/1] rcu: use atomic_read(v) instead of atomic_add_return(0, v)

2014-07-12 Thread Paul E. McKenney
On Fri, Jul 11, 2014 at 06:32:17PM -0400, Pranith Kumar wrote: On Fri, Jul 11, 2014 at 5:43 AM, Paul E. McKenney wrote: On Thu, Jul 10, 2014 at 09:17:33PM -0400, Pranith Kumar wrote: On Wed, Jul 9, 2014 at 3:56 PM, Paul E. McKenney paul...@linux.vnet.ibm.com wrote: snip OK, so

Re: [RFC PATCH 1/1] rcu: use atomic_read(v) instead of atomic_add_return(0, v)

2014-07-11 Thread Pranith Kumar
On Fri, Jul 11, 2014 at 5:43 AM, Paul E. McKenney wrote: > On Thu, Jul 10, 2014 at 09:17:33PM -0400, Pranith Kumar wrote: >> On Wed, Jul 9, 2014 at 3:56 PM, Paul E. McKenney >> wrote: >> >> > OK, so ->dynticks_snap is accessed by only one task, namely the >> > corresponding RCU grace-period

Re: [RFC PATCH 1/1] rcu: use atomic_read(v) instead of atomic_add_return(0, v)

2014-07-11 Thread Paul E. McKenney
On Thu, Jul 10, 2014 at 09:17:33PM -0400, Pranith Kumar wrote: > On Wed, Jul 9, 2014 at 3:56 PM, Paul E. McKenney > wrote: > > > OK, so ->dynticks_snap is accessed by only one task, namely the > > corresponding RCU grace-period kthread. So it can be accessed without > > any atomic instructions

Re: [RFC PATCH 1/1] rcu: use atomic_read(v) instead of atomic_add_return(0, v)

2014-07-11 Thread Paul E. McKenney
On Thu, Jul 10, 2014 at 09:17:33PM -0400, Pranith Kumar wrote: On Wed, Jul 9, 2014 at 3:56 PM, Paul E. McKenney paul...@linux.vnet.ibm.com wrote: snip OK, so -dynticks_snap is accessed by only one task, namely the corresponding RCU grace-period kthread. So it can be accessed without any

Re: [RFC PATCH 1/1] rcu: use atomic_read(v) instead of atomic_add_return(0, v)

2014-07-11 Thread Pranith Kumar
On Fri, Jul 11, 2014 at 5:43 AM, Paul E. McKenney wrote: On Thu, Jul 10, 2014 at 09:17:33PM -0400, Pranith Kumar wrote: On Wed, Jul 9, 2014 at 3:56 PM, Paul E. McKenney paul...@linux.vnet.ibm.com wrote: snip OK, so -dynticks_snap is accessed by only one task, namely the corresponding RCU

Re: [RFC PATCH 1/1] rcu: use atomic_read(v) instead of atomic_add_return(0, v)

2014-07-10 Thread Pranith Kumar
On Wed, Jul 9, 2014 at 3:56 PM, Paul E. McKenney wrote: > OK, so ->dynticks_snap is accessed by only one task, namely the > corresponding RCU grace-period kthread. So it can be accessed without > any atomic instructions or memory barriers, since all accesses to it are > single-threaded. On the

Re: [RFC PATCH 1/1] rcu: use atomic_read(v) instead of atomic_add_return(0, v)

2014-07-10 Thread Pranith Kumar
On Wed, Jul 9, 2014 at 3:56 PM, Paul E. McKenney paul...@linux.vnet.ibm.com wrote: snip OK, so -dynticks_snap is accessed by only one task, namely the corresponding RCU grace-period kthread. So it can be accessed without any atomic instructions or memory barriers, since all accesses to it are

Re: [RFC PATCH 1/1] rcu: use atomic_read(v) instead of atomic_add_return(0, v)

2014-07-09 Thread Paul E. McKenney
On Wed, Jul 09, 2014 at 12:00:10AM -0400, Pranith Kumar wrote: > On Tue, Jul 8, 2014 at 8:07 PM, Paul E. McKenney > wrote: > > On Tue, Jul 08, 2014 at 06:55:45PM -0400, Pranith Kumar wrote: > >> atomic_add_return() invalidates the cache line in other processors where-as > >> atomic_read does not.

Re: [RFC PATCH 1/1] rcu: use atomic_read(v) instead of atomic_add_return(0, v)

2014-07-09 Thread Paul E. McKenney
On Wed, Jul 09, 2014 at 12:00:10AM -0400, Pranith Kumar wrote: On Tue, Jul 8, 2014 at 8:07 PM, Paul E. McKenney paul...@linux.vnet.ibm.com wrote: On Tue, Jul 08, 2014 at 06:55:45PM -0400, Pranith Kumar wrote: atomic_add_return() invalidates the cache line in other processors where-as

Re: [RFC PATCH 1/1] rcu: use atomic_read(v) instead of atomic_add_return(0, v)

2014-07-08 Thread Pranith Kumar
On Tue, Jul 8, 2014 at 8:07 PM, Paul E. McKenney wrote: > On Tue, Jul 08, 2014 at 06:55:45PM -0400, Pranith Kumar wrote: >> atomic_add_return() invalidates the cache line in other processors where-as >> atomic_read does not. I don't see why we would need invalidation in this >> case. >> If

Re: [RFC PATCH 1/1] rcu: use atomic_read(v) instead of atomic_add_return(0, v)

2014-07-08 Thread Paul E. McKenney
On Tue, Jul 08, 2014 at 06:55:45PM -0400, Pranith Kumar wrote: > atomic_add_return() invalidates the cache line in other processors where-as > atomic_read does not. I don't see why we would need invalidation in this case. > If indeed it was need a comment would be helpful for readers. Otherwise >

[RFC PATCH 1/1] rcu: use atomic_read(v) instead of atomic_add_return(0, v)

2014-07-08 Thread Pranith Kumar
atomic_add_return() invalidates the cache line in other processors where-as atomic_read does not. I don't see why we would need invalidation in this case. If indeed it was need a comment would be helpful for readers. Otherwise doesn't using atomic_read() make more sense here? RFC! replace

[RFC PATCH 1/1] rcu: use atomic_read(v) instead of atomic_add_return(0, v)

2014-07-08 Thread Pranith Kumar
atomic_add_return() invalidates the cache line in other processors where-as atomic_read does not. I don't see why we would need invalidation in this case. If indeed it was need a comment would be helpful for readers. Otherwise doesn't using atomic_read() make more sense here? RFC! replace

Re: [RFC PATCH 1/1] rcu: use atomic_read(v) instead of atomic_add_return(0, v)

2014-07-08 Thread Paul E. McKenney
On Tue, Jul 08, 2014 at 06:55:45PM -0400, Pranith Kumar wrote: atomic_add_return() invalidates the cache line in other processors where-as atomic_read does not. I don't see why we would need invalidation in this case. If indeed it was need a comment would be helpful for readers. Otherwise

Re: [RFC PATCH 1/1] rcu: use atomic_read(v) instead of atomic_add_return(0, v)

2014-07-08 Thread Pranith Kumar
On Tue, Jul 8, 2014 at 8:07 PM, Paul E. McKenney paul...@linux.vnet.ibm.com wrote: On Tue, Jul 08, 2014 at 06:55:45PM -0400, Pranith Kumar wrote: atomic_add_return() invalidates the cache line in other processors where-as atomic_read does not. I don't see why we would need invalidation in this