Use workqueue in rculfhash
A message that is not in the archive (sent off-list or not yet received): [email protected]
RFC PATCH 1/2 Implement urcu workqueues internal API
--- src/Makefile.am | 2 +- src/workqueue.c | 507 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/workqueue.h | 104 ++++++++++++ 3 files changed, 612 insertions(+), 1 deletion(-) create mode 100644 src/workqueue.c create mode 100644 src/workqueue.h
src/Makefile.am +1 -1
@@ -54,7 +54,7 @@ liburcu_bp_la_SOURCES = urcu-bp.c urcu-pointer.c $(COMPAT) liburcu_bp_la_LIBADD = liburcu-common.la liburcu_cds_la_SOURCES = rculfqueue.c rculfstack.c lfstack.c \ - $(RCULFHASH) $(COMPAT) + workqueue.c workqueue.h $(RCULFHASH) $(COMPAT) liburcu_cds_la_LIBADD = liburcu-common.la pkgconfigdir = $(libdir)/pkgconfig
src/workqueue.c new file +507 -0
507 lines not on this page · raw message
src/workqueue.h new file +104 -0
104 lines not on this page · raw message
Signature · 6 lines
2.1.4 _______________________________________________ lttng-dev mailing list [email protected] https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
PATCH 2/2 Use workqueue in rculfhash
In reply to a message not in the archive--- include/urcu/rculfhash.h | 15 ++++-- src/rculfhash-internal.h | 2 +- src/rculfhash.c | 124 +++++++++++++++++++++++------------------------ 3 files changed, 74 insertions(+), 67 deletions(-)
include/urcu/rculfhash.h +11 -4
@@ -176,10 +176,17 @@ struct cds_lfht *cds_lfht_new(unsigned long init_size,* need to be informed of the value passed to cds_lfht_new(). * * Return 0 on success, negative error value on error. -* Threads calling this API need to be registered RCU read-side threads. -* cds_lfht_destroy should *not* be called from a RCU read-side critical -* section. It should *not* be called from a call_rcu thread context -* neither. + +* Prior to liburcu 0.10: +* - Threads calling this API need to be registered RCU read-side +* threads. +* - cds_lfht_destroy should *not* be called from a RCU read-side +* critical section. It should *not* be called from a call_rcu thread +* context neither. +* +* Starting from liburcu 0.10, rculfhash implements its own worker +* thread to handle resize operations, which removes RCU requirements on +* cds_lfht_destroy. */ extern int cds_lfht_destroy (struct cds_lfht *ht,pthread_attr_t **attr);
src/rculfhash-internal.h +1 -1
@@ -82,7 +82,7 @@ struct cds_lfht {*/ pthread_mutex_t resize_mutex;/* resize mutex: add/del mutex */ pthread_attr_t *resize_attr;/* Resize threads attributes */ -unsigned int in_progress_resize, in_progress_destroy; +unsigned int in_progress_destroy;unsigned long resize_target;int resize_initiated;
src/rculfhash.c +62 -62
234 lines not on this page · raw message
Signature · 6 lines
2.1.4 _______________________________________________ lttng-dev mailing list [email protected] https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Re: [RFC PATCH liburcu 0/2] Remove RCU requirements on hash table destroy
In reply to a message not in the archiveQuoted 8 lines · Mathieu Desnoyers
The RCU lock-free hash table currently requires that the destroy function should not be called from within RCU read-side critical sections. This is caused by the lazy resize, which uses the
call_rcuworker thread, even though all it really needs is a workqueue/worker thread scheme.Implement an internal workqueue API in liburcu, and use it instead of
call_rcuin rculfhash to overcome this limitation.
Took a quick look, and it appears plausible.
Some opportunity to share CPU-affinity code between this and the call_rcu() code, FWIW. Two of the system-call stubs look to be identical other than the system call (EINTR checks and soforth), but I am not sure that it is worth combining them.
Thanx, Paul
Quoted 4 lines
Mathieu Desnoyers (2):
Implement urcu workqueues internal API
Use workqueue in rculfhash
Quoted 13 lines
include/urcu/rculfhash.h | 15 +- src/Makefile.am | 2 +- src/rculfhash-internal.h | 2 +- src/rculfhash.c | 124 ++++++------ src/workqueue.c | 507 +++++++++++++++++++++++++++++++++++++++++++++++ src/workqueue.h | 104 ++++++++++ 6 files changed, 686 insertions(+), 68 deletions(-) create mode 100644 src/workqueue.c create mode 100644 src/workqueue.hSignature · 1 line
2.1.4
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [RFC PATCH liburcu 0/2] Remove RCU requirements on hash table destroy
Quoted 7 lines · ----- On Jun 5, 2017, at 6:56 PM, Paul E. McKenney [email protected]…
Quoted 6 lines · Mathieu Desnoyers
The RCU lock-free hash table currently requires that the destroy function should not be called from within RCU read-side critical sections. This is caused by the lazy resize, which uses the
call_rcuworker thread, even though all it really needs is a workqueue/worker thread scheme.
Quoted 7 lines
Quoted 2 lines
Implement an internal workqueue API in liburcu, and use it instead of
call_rcuin rculfhash to overcome this limitation.Took a quick look, and it appears plausible.
Some opportunity to share CPU-affinity code between this and the
call_rcu()code, FWIW.
Given that I plan to reimplement the call_rcu code using this new internal workqueue API, I don't think it is useful to try to lift out the duplicated code between call_rcu and workqueue. When call_rcu is reimplemented, the duplicated cpu affinity code will vanish.
Quoted 3 lines
Two of the system-call stubs look to be identical
other than the system call (EINTR checks and soforth), but I am not sure that it is worth combining them.
Are you talking about the futex wait/wakeup ? If so, would the attached patch that combine those work for you ? I noticed that even the error handling is identical.
Thanks,
Mathieu
Signature · 3 lines
Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev