Stop workqueue threads at process exit time, to make valgrind happy.

Signed-off-by: Justin Husted <sigstop@gmail.com>
This commit is contained in:
Justin Husted 2019-11-02 23:36:29 -07:00 committed by Kent Overstreet
parent b20e160735
commit 97c6f60222

View File

@ -307,3 +307,16 @@ static void wq_init(void)
BUG_ON(!system_wq || !system_highpri_wq || !system_long_wq ||
!system_unbound_wq || !system_freezable_wq);
}
__attribute__((destructor(102)))
static void wq_cleanup(void)
{
destroy_workqueue(system_freezable_wq);
destroy_workqueue(system_unbound_wq);
destroy_workqueue(system_long_wq);
destroy_workqueue(system_highpri_wq);
destroy_workqueue(system_wq);
system_wq = system_highpri_wq = system_long_wq = system_unbound_wq =
system_freezable_wq = NULL;
}