On completion of a batch of jobs from the work queue, a wait of 10
ms (using poll()) is performed if there is no work present in the
work queue before waiting on its futex.

The work queue thread's structure is inspired by the call-rcu thread.
In the context of the call-rcu thread, my understanding is that the
intention is to ensure that the thread does not continuously wake-up
to process a single queued item. This is fine as an application should
not wait for a call-rcu job to be executed (or at least I don't see a
use-case for that).

In the context of the work queue, waiting for more work to be available
artificially slows down the execution of work on which an application
may wait.

I have observed a case where LTTng's session daemon's shutdown is
takes around 4 seconds as a large number of cds_lfht objects are
destroyed. Removing the wait reduces the duration of this phase of the
shut-down to almost ~10ms.

Signed-off-by: Jérémie Galarneau <jeremie.galarn...@efficios.com>
---
 src/workqueue.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/workqueue.c b/src/workqueue.c
index 8561a7a..d609006 100644
--- a/src/workqueue.c
+++ b/src/workqueue.c
@@ -240,7 +240,6 @@ static void *workqueue_thread(void *arg)
                        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
-- 
2.19.2

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Reply via email to