From 88c836c26719406484c95636e5a7933a29164cd7 Mon Sep 17 00:00:00 2001 From: Mohamed Feroz Date: Thu, 29 Aug 2024 08:04:02 +0000 Subject: vcl: fix vcl issue in multi-thread-workers mode In some multi-process/thread applications, a connection FD is created on main process and actual data processing is done in worker process. The main process does nothing. For such applications, when multi-thread-workers is enabled, in current VLS code, the session events are still enqueued to the VCL worker corresponding to Main process. As the main process is not dequeuing any event, application doesn't move forward. This patch fixes this issue by enabling VCL worker corresponding to the Worker process as listener of the session. Type: improvement Signed-off-by: Mohamed Feroz Change-Id: Ia7e6270c1acbce7feeafbf281c661285d63c3b22 --- src/vcl/vcl_locked.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/vcl/vcl_locked.c b/src/vcl/vcl_locked.c index 69dd15b0ef4..93ece0027ff 100644 --- a/src/vcl/vcl_locked.c +++ b/src/vcl/vcl_locked.c @@ -374,6 +374,12 @@ vls_worker_get_current (void) return pool_elt_at_index (vlsm->workers, vls_get_worker_index ()); } +static inline u8 +vls_n_workers (void) +{ + return pool_elts (vlsm->workers); +} + static void vls_worker_alloc (void) { @@ -1298,7 +1304,7 @@ vls_mp_checks (vcl_locked_session_t * vls, int is_add) vcl_session_t *s; u32 owner_wrk; - if (vls_mt_wrk_supported ()) + if (vls_mt_wrk_supported () && vls_n_workers () <= 1) return; ASSERT (wrk->wrk_index == vls->vcl_wrk_index); -- cgit 1.2.3-korg