re-document rculfstack and even rename it
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 14 lines · Lai Jiangshan
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) usercu_read_lock()to protectcds_lfs_pop_rcu()and usesynchronize_rcu()orcall_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 protectcds_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 callcds_lfs_pop_rcu(). (multi-providers-single customer)
D) others, like read-write locks.
Quoted 4 lines
I consider B) and C) are more popular. In linux kernel,
kernel/task_work.cuses 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
Quoted 3 lines · * Lai Jiangshan ([email protected]) 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().
Quoted 10 lines
2)
cds_lfs_pop_rcu()don't only one of the following synchronization(not only RCU):
A) usercu_read_lock()to protectcds_lfs_pop_rcu()and usesynchronize_rcu()orcall_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 protectcds_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 callcds_lfs_pop_rcu(). (multi-providers-single customer)
D) others, like read-write locks.
Quoted 4 lines
I consider B) and C) are more popular. In linux kernel,
kernel/task_work.cuses 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
Quoted 8 lines
Thanks,
Lai_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Signature · 4 lines
Mathieu Desnoyers Operating System Efficiency R&D Consultant EfficiOS Inc. http://www.efficios.com
A message that is not in the archive (sent off-list or not yet received): 20121011182255.GA19783@Krystal
Quoted 21 lines · Mathieu Desnoyers
Quoted 3 lines · * Lai Jiangshan ([email protected]) 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().Quoted 13 lines
2)
cds_lfs_pop_rcu()don't only one of the following synchronization(not only RCU):
A) usercu_read_lock()to protectcds_lfs_pop_rcu()and usesynchronize_rcu()orcall_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 protectcds_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 callcds_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.cuses a hybird ways of B) and C).
Quoted 8 lines
Quoted 1 line
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