projects
/
urcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: tls-compat.h exposes compiler-dependent public configuration
[urcu.git]
/
src
/
workqueue.c
diff --git
a/src/workqueue.c
b/src/workqueue.c
index 17ea835779b8bed4f4ab77fc70b0c5ba7d6ca8a3..59eb21d534e9446df3f477795062e9dba4ec2abc 100644
(file)
--- a/
src/workqueue.c
+++ b/
src/workqueue.c
@@
-36,13
+36,12
@@
#include <sched.h>
#include "compat-getcpu.h"
#include <sched.h>
#include "compat-getcpu.h"
-#include "urcu/wfcqueue.h"
-#include "urcu-call-rcu.h"
-#include "urcu-pointer.h"
-#include "urcu/list.h"
-#include "urcu/futex.h"
-#include "urcu/tls-compat.h"
-#include "urcu/ref.h"
+#include <urcu/wfcqueue.h>
+#include <urcu/pointer.h>
+#include <urcu/list.h>
+#include <urcu/futex.h>
+#include <urcu/tls-compat.h>
+#include <urcu/ref.h>
#include "urcu-die.h"
#include "workqueue.h"
#include "urcu-die.h"
#include "workqueue.h"
@@
-55,10
+54,9
@@
struct urcu_workqueue {
/*
* We do not align head on a different cache-line than tail
struct urcu_workqueue {
/*
* We do not align head on a different cache-line than tail
- * mainly because call_rcu callback-invocation threads use
- * batching ("splice") to get an entire list of callbacks, which
- * effectively empties the queue, and requires to touch the tail
- * anyway.
+ * mainly because workqueue threads use batching ("splice") to
+ * get an entire list of callbacks, which effectively empties
+ * the queue, and requires to touch the tail anyway.
*/
struct cds_wfcq_tail cbs_tail;
struct cds_wfcq_head cbs_head;
*/
struct cds_wfcq_tail cbs_tail;
struct cds_wfcq_head cbs_head;
@@
-223,11
+221,11
@@
static void *workqueue_thread(void *arg)
cbcount = 0;
__cds_wfcq_for_each_blocking_safe(&cbs_tmp_head,
&cbs_tmp_tail, cbs, cbs_tmp_n) {
cbcount = 0;
__cds_wfcq_for_each_blocking_safe(&cbs_tmp_head,
&cbs_tmp_tail, cbs, cbs_tmp_n) {
- struct
rcu_head *rh
p;
+ struct
urcu_work *uw
p;
-
rh
p = caa_container_of(cbs,
- struct
rcu_head
, next);
-
rhp->func(rh
p);
+
uw
p = caa_container_of(cbs,
+ struct
urcu_work
, next);
+
uwp->func(uw
p);
cbcount++;
}
uatomic_sub(&workqueue->qlen, cbcount);
cbcount++;
}
uatomic_sub(&workqueue->qlen, cbcount);
@@
-240,25
+238,25
@@
static void *workqueue_thread(void *arg)
if (cds_wfcq_empty(&workqueue->cbs_head,
&workqueue->cbs_tail)) {
futex_wait(&workqueue->futex);
if (cds_wfcq_empty(&workqueue->cbs_head,
&workqueue->cbs_tail)) {
futex_wait(&workqueue->futex);
- (void) poll(NULL, 0, 10);
uatomic_dec(&workqueue->futex);
/*
* Decrement futex before reading
uatomic_dec(&workqueue->futex);
/*
* Decrement futex before reading
- *
call_rcu
list.
+ *
urcu_work
list.
*/
cmm_smp_mb();
*/
cmm_smp_mb();
- } else {
- (void) poll(NULL, 0, 10);
}
} else {
}
} else {
- (void) poll(NULL, 0, 10);
+ if (cds_wfcq_empty(&workqueue->cbs_head,
+ &workqueue->cbs_tail)) {
+ (void) poll(NULL, 0, 10);
+ }
}
if (workqueue->worker_after_wake_up_fct)
workqueue->worker_after_wake_up_fct(workqueue, workqueue->priv);
}
if (!rt) {
/*
}
if (workqueue->worker_after_wake_up_fct)
workqueue->worker_after_wake_up_fct(workqueue, workqueue->priv);
}
if (!rt) {
/*
- * Read
call_rcu
list before write futex.
+ * Read
urcu_work
list before write futex.
*/
cmm_smp_mb();
uatomic_set(&workqueue->futex, 0);
*/
cmm_smp_mb();
uatomic_set(&workqueue->futex, 0);
@@
-309,7
+307,7
@@
struct urcu_workqueue *urcu_workqueue_create(unsigned long flags,
static void wake_worker_thread(struct urcu_workqueue *workqueue)
{
static void wake_worker_thread(struct urcu_workqueue *workqueue)
{
- if (!(_CMM_LOAD_SHARED(workqueue->flags) & URCU_
CALL_RCU
_RT))
+ if (!(_CMM_LOAD_SHARED(workqueue->flags) & URCU_
WORKQUEUE
_RT))
futex_wake_up(&workqueue->futex);
}
futex_wake_up(&workqueue->futex);
}
This page took
0.026381 seconds
and
4
git commands to generate.