From 777bbe18f49af2754020411a478cbf3389fb29f2 Mon Sep 17 00:00:00 2001 From: Octavian Purdila Date: Thu, 26 Jan 2017 17:28:12 +0200 Subject: [PATCH] lkl: remove threads counter Now that we have synchronous thread termination due to thread_join ops, we don't need the threads_counter anymore. Signed-off-by: Octavian Purdila --- arch/lkl/include/asm/thread_info.h | 1 - arch/lkl/kernel/setup.c | 1 - arch/lkl/kernel/threads.c | 16 +--------------- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/arch/lkl/include/asm/thread_info.h b/arch/lkl/include/asm/thread_info.h index 408f4a7ca39106..de00569f158e4c 100644 --- a/arch/lkl/include/asm/thread_info.h +++ b/arch/lkl/include/asm/thread_info.h @@ -49,7 +49,6 @@ void free_thread_stack(struct task_struct *tsk); void threads_init(void); void threads_cleanup(void); -void threads_cnt_dec(void); #define TIF_SYSCALL_TRACE 0 #define TIF_NOTIFY_RESUME 1 diff --git a/arch/lkl/kernel/setup.c b/arch/lkl/kernel/setup.c index 501d32175dc426..d6da246d3a6b28 100644 --- a/arch/lkl/kernel/setup.c +++ b/arch/lkl/kernel/setup.c @@ -160,7 +160,6 @@ static int lkl_run_init(struct linux_binprm *bprm) init_pid_ns.child_reaper = 0; syscalls_init(); - threads_cnt_dec(); lkl_ops->sem_up(init_sem); lkl_ops->thread_exit(); diff --git a/arch/lkl/kernel/threads.c b/arch/lkl/kernel/threads.c index 3518d804b9c131..caede2f80f2d64 100644 --- a/arch/lkl/kernel/threads.c +++ b/arch/lkl/kernel/threads.c @@ -5,8 +5,6 @@ #include #include -static volatile int threads_counter; - static int init_ti(struct thread_info *ti) { ti->sched_sem = lkl_ops->sem_alloc(0); @@ -122,10 +120,8 @@ struct task_struct *__switch_to(struct task_struct *prev, lkl_ops->sem_down(_prev->sched_sem); } - if (_prev->dead) { - __sync_fetch_and_sub(&threads_counter, 1); + if (_prev->dead) lkl_ops->thread_exit(); - } return abs_prev; } @@ -193,8 +189,6 @@ int copy_thread(unsigned long clone_flags, unsigned long esp, return -ENOMEM; } - __sync_fetch_and_add(&threads_counter, 1); - return 0; } @@ -218,11 +212,6 @@ void threads_init(void) ti->tid = lkl_ops->thread_self(); } -void threads_cnt_dec(void) -{ - __sync_fetch_and_sub(&threads_counter, 1); -} - void threads_cleanup(void) { struct task_struct *p, *t; @@ -239,8 +228,5 @@ void threads_cleanup(void) kill_thread(ti); } - while (threads_counter) - ; - lkl_ops->sem_free(init_thread_union.thread_info.sched_sem); }