[lttng-dev] [PATCH urcu 4/4] [RFC] Fix: only wait if work queue is empty in real-time mode

Jérémie Galarneau jeremie.galarneau at efficios.com
Fri Dec 7 17:06:39 EST 2018


Unconditionally waiting for 10 ms after the completion of every batch
of jobs of the work queue in real-time mode appears to be a behaviour
inherited from the call-rcu thread.

While this is a fair trade-off in the context of call-rcu, it is less
evident that it is desirable in the context of a general-purpose
work queue. Waiting when work is available artificially degrades the
latency characteristics of the work queue.

There may be other trade-offs that I am not aware of. Hence, this
is submitted as "RFC".

Signed-off-by: Jérémie Galarneau <jeremie.galarneau at efficios.com>
---
 src/workqueue.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/workqueue.c b/src/workqueue.c
index 6822314..d81e381 100644
--- a/src/workqueue.c
+++ b/src/workqueue.c
@@ -248,7 +248,10 @@ static void *workqueue_thread(void *arg)
 				cmm_smp_mb();
 			}
 		} 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);
-- 
2.19.2



More information about the lttng-dev mailing list