All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [RFC] re-document rculfstack and even rename it
       [not found] <50752928.3050006@cn.fujitsu.com>
@ 2012-10-10 14:59 ` Paul E. McKenney
  2012-10-11 18:22 ` Mathieu Desnoyers
       [not found] ` <20121011182255.GA19783@Krystal>
  2 siblings, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2012-10-10 14:59 UTC (permalink / raw)
  To: Lai Jiangshan; +Cc: lttng-dev, Mathieu Desnoyers

On Wed, Oct 10, 2012 at 03:52:08PM +0800, Lai Jiangshan wrote:
> rculfstack is not really require RCU-only.
> 
> 1) cds_lfs_push_rcu() don't need any lock, don't need RCU nor other locks.
> 
> 2) cds_lfs_pop_rcu() don't only one of the following synchronization(not only RCU):
> 	A) use rcu_read_lock() to protect cds_lfs_pop_rcu() and use synchronize_rcu()
>            or call_rcu() to free the popped node. (current comments said we need this
>            synchronization, and thus we named this struct with rcu prefix. But actually,
> 	   the followings are OK, and are more popular/friendly)
> 	B) use mutexs/locks to protect cds_lfs_pop_rcu(), we can free to free/modify the
> 	   popped node any time, we don't need any synchronization when free them.
> 	C) only ONE thread can call cds_lfs_pop_rcu(). (multi-providers-single customer)
> 	D) others, like read-write locks.
> 
> I consider B) and C) are more popular. In linux kernel,
> kernel/task_work.c uses a hybird ways of B) and C).
> 
> I suggest to rename it, Or document B) and C) at least.

Good timing -- stacks and queues are next on my list for documentation.  ;-)

							Thanx, Paul

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] re-document rculfstack and even rename it
       [not found] <50752928.3050006@cn.fujitsu.com>
  2012-10-10 14:59 ` [RFC] re-document rculfstack and even rename it Paul E. McKenney
@ 2012-10-11 18:22 ` Mathieu Desnoyers
       [not found] ` <20121011182255.GA19783@Krystal>
  2 siblings, 0 replies; 4+ messages in thread
From: Mathieu Desnoyers @ 2012-10-11 18:22 UTC (permalink / raw)
  To: Lai Jiangshan; +Cc: lttng-dev, Paul E. McKenney

* Lai Jiangshan (laijs@cn.fujitsu.com) wrote:
> rculfstack is not really require RCU-only.
> 
> 1) cds_lfs_push_rcu() don't need any lock, don't need RCU nor other locks.

Good point ! I even documented this peculiarness in the
comment at the top of _cds_lfs_push_rcu().

> 2) cds_lfs_pop_rcu() don't only one of the following synchronization(not only RCU):
> 	A) use rcu_read_lock() to protect cds_lfs_pop_rcu() and use synchronize_rcu()
>            or call_rcu() to free the popped node. (current comments said we need this
>            synchronization, and thus we named this struct with rcu prefix. But actually,
> 	   the followings are OK, and are more popular/friendly)
> 	B) use mutexs/locks to protect cds_lfs_pop_rcu(), we can free to free/modify the
> 	   popped node any time, we don't need any synchronization when free them.
> 	C) only ONE thread can call cds_lfs_pop_rcu(). (multi-providers-single customer)
> 	D) others, like read-write locks.
> 
> I consider B) and C) are more popular. In linux kernel,
> kernel/task_work.c uses a hybird ways of B) and C).
> 
> I suggest to rename it, Or document B) and C) at least.

Yes, agreed! Do you suggest we introduce a "lfstack", and slowly
deprecate rculfstack ?

We could then document the various ways to protect "pop", and also
implement a "splice" operation while we are there.

Thoughts ?

Thanks,

Mathieu

> 
> Thanks,
> Lai
> 
> _______________________________________________
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] re-document rculfstack and even rename it
       [not found] ` <20121011182255.GA19783@Krystal>
@ 2012-10-12  2:25   ` Lai Jiangshan
  0 siblings, 0 replies; 4+ messages in thread
From: Lai Jiangshan @ 2012-10-12  2:25 UTC (permalink / raw)
  To: Mathieu Desnoyers; +Cc: lttng-dev, Paul E. McKenney

On 10/12/2012 02:22 AM, Mathieu Desnoyers wrote:
> * Lai Jiangshan (laijs@cn.fujitsu.com) wrote:
>> rculfstack is not really require RCU-only.
>>
>> 1) cds_lfs_push_rcu() don't need any lock, don't need RCU nor other locks.
> 
> Good point ! I even documented this peculiarness in the
> comment at the top of _cds_lfs_push_rcu().
> 
>> 2) cds_lfs_pop_rcu() don't only one of the following synchronization(not only RCU):
>> 	A) use rcu_read_lock() to protect cds_lfs_pop_rcu() and use synchronize_rcu()
>>            or call_rcu() to free the popped node. (current comments said we need this
>>            synchronization, and thus we named this struct with rcu prefix. But actually,
>> 	   the followings are OK, and are more popular/friendly)
>> 	B) use mutexs/locks to protect cds_lfs_pop_rcu(), we can free to free/modify the
>> 	   popped node any time, we don't need any synchronization when free them.
>> 	C) only ONE thread can call cds_lfs_pop_rcu(). (multi-providers-single customer)
>> 	D) others, like read-write locks.
>>
>> I consider B) and C) are more popular. In linux kernel,
>> kernel/task_work.c uses a hybird ways of B) and C).
>>
>> I suggest to rename it, Or document B) and C) at least.
> 
> Yes, agreed! Do you suggest we introduce a "lfstack", and slowly
> deprecate rculfstack ?
> 
> We could then document the various ways to protect "pop", and also
> implement a "splice" operation while we are there.
> 

Acked.

Thanks,
Lai

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RFC] re-document rculfstack and even rename it
@ 2012-10-10  7:52 Lai Jiangshan
  0 siblings, 0 replies; 4+ messages in thread
From: Lai Jiangshan @ 2012-10-10  7:52 UTC (permalink / raw)
  To: Paul E. McKenney, Mathieu Desnoyers, lttng-dev

rculfstack is not really require RCU-only.

1) cds_lfs_push_rcu() don't need any lock, don't need RCU nor other locks.

2) cds_lfs_pop_rcu() don't only one of the following synchronization(not only RCU):
	A) use rcu_read_lock() to protect cds_lfs_pop_rcu() and use synchronize_rcu()
           or call_rcu() to free the popped node. (current comments said we need this
           synchronization, and thus we named this struct with rcu prefix. But actually,
	   the followings are OK, and are more popular/friendly)
	B) use mutexs/locks to protect cds_lfs_pop_rcu(), we can free to free/modify the
	   popped node any time, we don't need any synchronization when free them.
	C) only ONE thread can call cds_lfs_pop_rcu(). (multi-providers-single customer)
	D) others, like read-write locks.

I consider B) and C) are more popular. In linux kernel,
kernel/task_work.c uses a hybird ways of B) and C).

I suggest to rename it, Or document B) and C) at least.

Thanks,
Lai

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-12  2:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <50752928.3050006@cn.fujitsu.com>
2012-10-10 14:59 ` [RFC] re-document rculfstack and even rename it Paul E. McKenney
2012-10-11 18:22 ` Mathieu Desnoyers
     [not found] ` <20121011182255.GA19783@Krystal>
2012-10-12  2:25   ` Lai Jiangshan
2012-10-10  7:52 Lai Jiangshan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.