Skip to content

Commit 777bbe1

Browse files
committed
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 <tavi@cs.pub.ro>
1 parent 44336b1 commit 777bbe1

File tree

3 files changed

+1
-17
lines changed

3 files changed

+1
-17
lines changed

arch/lkl/include/asm/thread_info.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ void free_thread_stack(struct task_struct *tsk);
4949

5050
void threads_init(void);
5151
void threads_cleanup(void);
52-
void threads_cnt_dec(void);
5352

5453
#define TIF_SYSCALL_TRACE 0
5554
#define TIF_NOTIFY_RESUME 1

arch/lkl/kernel/setup.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ static int lkl_run_init(struct linux_binprm *bprm)
160160
init_pid_ns.child_reaper = 0;
161161

162162
syscalls_init();
163-
threads_cnt_dec();
164163

165164
lkl_ops->sem_up(init_sem);
166165
lkl_ops->thread_exit();

arch/lkl/kernel/threads.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
#include <asm/cpu.h>
66
#include <asm/sched.h>
77

8-
static volatile int threads_counter;
9-
108
static int init_ti(struct thread_info *ti)
119
{
1210
ti->sched_sem = lkl_ops->sem_alloc(0);
@@ -122,10 +120,8 @@ struct task_struct *__switch_to(struct task_struct *prev,
122120
lkl_ops->sem_down(_prev->sched_sem);
123121
}
124122

125-
if (_prev->dead) {
126-
__sync_fetch_and_sub(&threads_counter, 1);
123+
if (_prev->dead)
127124
lkl_ops->thread_exit();
128-
}
129125

130126
return abs_prev;
131127
}
@@ -193,8 +189,6 @@ int copy_thread(unsigned long clone_flags, unsigned long esp,
193189
return -ENOMEM;
194190
}
195191

196-
__sync_fetch_and_add(&threads_counter, 1);
197-
198192
return 0;
199193
}
200194

@@ -218,11 +212,6 @@ void threads_init(void)
218212
ti->tid = lkl_ops->thread_self();
219213
}
220214

221-
void threads_cnt_dec(void)
222-
{
223-
__sync_fetch_and_sub(&threads_counter, 1);
224-
}
225-
226215
void threads_cleanup(void)
227216
{
228217
struct task_struct *p, *t;
@@ -239,8 +228,5 @@ void threads_cleanup(void)
239228
kill_thread(ti);
240229
}
241230

242-
while (threads_counter)
243-
;
244-
245231
lkl_ops->sem_free(init_thread_union.thread_info.sched_sem);
246232
}

0 commit comments

Comments
 (0)