From mboxrd@z Thu Jan 1 00:00:00 1970 From: paulmck@linux.vnet.ibm.com (Paul E. McKenney) Date: Wed, 10 Oct 2012 07:59:59 -0700 Subject: [lttng-dev] [RFC] re-document rculfstack and even rename it In-Reply-To: <50752928.3050006@cn.fujitsu.com> References: <50752928.3050006@cn.fujitsu.com> Message-ID: <20121010145959.GA2495@linux.vnet.ibm.com> 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