From: Mathieu Desnoyers Date: Fri, 10 Feb 2023 19:55:24 +0000 (-0500) Subject: Fix: call_rcu: teardown default call_rcu worker on application exit X-Git-Tag: v0.14.0~3 X-Git-Url: https://git.lttng.org/?a=commitdiff_plain;h=90f72b8c054ca4e3b4b45f630549c784e26ce79a;hp=90f72b8c054ca4e3b4b45f630549c784e26ce79a;p=userspace-rcu.git Fix: call_rcu: teardown default call_rcu worker on application exit Teardown the default call_rcu worker thread if there are no queued callbacks on process exit. This prevents leaking memory. Here is how an application can ensure graceful teardown of this worker thread: - An application queuing call_rcu callbacks should invoke rcu_barrier() before it exits. - When chaining call_rcu callbacks, the number of calls to rcu_barrier() on application exit must match at least the maximum number of chained callbacks. - If an application chains callbacks endlessly, it would have to be modified to stop chaining callbacks when it detects an application exit (e.g. with a flag), and wait for quiescence with rcu_barrier() after setting that flag. - The statements above apply to a library which queues call_rcu callbacks, only it needs to invoke rcu_barrier in its library destructor. Fixes: #1317 Signed-off-by: Mathieu Desnoyers Change-Id: I40556bc872d3df58a22fb88a0dbb528ce5c9b4af ---