From 758c5aa895d026146c66f8637d992ba6e72021a1 Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Tue, 31 Mar 2020 06:41:11 -0400 Subject: [PATCH] Don't hold reference to module in thread Since stopping threads have to be done synchronusly, there is no need to keep reference to cas_cache module in each thread. Signed-off-by: Michal Mielewczyk --- modules/cas_cache/threads.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/cas_cache/threads.c b/modules/cas_cache/threads.c index 4854782..f83f37f 100644 --- a/modules/cas_cache/threads.c +++ b/modules/cas_cache/threads.c @@ -54,7 +54,7 @@ static int _cas_io_queue_thread(void *data) wait_for_completion(&info->compl); printk(KERN_DEBUG "Thread %s stopped\n", info->name); kfree(info); - module_put_and_exit(0); + do_exit(0); return 0; } @@ -115,7 +115,7 @@ static int _cas_cleaner_thread(void *data) wait_for_completion(&info->compl); kfree(info); - module_put_and_exit(0); + do_exit(0); return 0; } @@ -149,7 +149,7 @@ static int _cas_metadata_updater_thread(void *data) wait_for_completion(&info->compl); kfree(info); - module_put_and_exit(0); + do_exit(0); return 0; } @@ -183,8 +183,6 @@ static int _cas_create_thread(struct cas_thread_info **pinfo, } info->thread = thread; - BUG_ON(!try_module_get(THIS_MODULE)); - /* Affinitize thread to core */ if (cpu != CAS_CPUS_ALL) kthread_bind(thread, cpu);