Fix: call_rcu: teardown default call_rcu worker on application exit
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 10 Feb 2023 19:55:24 +0000 (14:55 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 10 Feb 2023 22:26:05 +0000 (17:26 -0500)
commit90f72b8c054ca4e3b4b45f630549c784e26ce79a
treef8d49968f2520dfba61ce5837209089a8fbc46e3
parent1cf55ba47342156cdf25335264b9774a16e0bb2d
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 <mathieu.desnoyers@efficios.com>
Change-Id: I40556bc872d3df58a22fb88a0dbb528ce5c9b4af
src/urcu-bp.c
src/urcu-call-rcu-impl.h
src/urcu-qsbr.c
src/urcu.c
This page took 0.026029 seconds and 4 git commands to generate.