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 <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk 2020-03-31 06:41:11 -04:00
parent d9ca4f4bd4
commit 758c5aa895

View File

@ -54,7 +54,7 @@ static int _cas_io_queue_thread(void *data)
wait_for_completion(&info->compl); wait_for_completion(&info->compl);
printk(KERN_DEBUG "Thread %s stopped\n", info->name); printk(KERN_DEBUG "Thread %s stopped\n", info->name);
kfree(info); kfree(info);
module_put_and_exit(0); do_exit(0);
return 0; return 0;
} }
@ -115,7 +115,7 @@ static int _cas_cleaner_thread(void *data)
wait_for_completion(&info->compl); wait_for_completion(&info->compl);
kfree(info); kfree(info);
module_put_and_exit(0); do_exit(0);
return 0; return 0;
} }
@ -149,7 +149,7 @@ static int _cas_metadata_updater_thread(void *data)
wait_for_completion(&info->compl); wait_for_completion(&info->compl);
kfree(info); kfree(info);
module_put_and_exit(0); do_exit(0);
return 0; return 0;
} }
@ -183,8 +183,6 @@ static int _cas_create_thread(struct cas_thread_info **pinfo,
} }
info->thread = thread; info->thread = thread;
BUG_ON(!try_module_get(THIS_MODULE));
/* Affinitize thread to core */ /* Affinitize thread to core */
if (cpu != CAS_CPUS_ALL) if (cpu != CAS_CPUS_ALL)
kthread_bind(thread, cpu); kthread_bind(thread, cpu);