Skip to content

Commit

Permalink
Merge pull request torvalds#307 from tavip/remove-threads-counter
Browse files Browse the repository at this point in the history
lkl: remove threads_counter
  • Loading branch information
tavip committed Jan 27, 2017
2 parents 44336b1 + 777bbe1 commit cd60be9
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 17 deletions.
1 change: 0 additions & 1 deletion arch/lkl/include/asm/thread_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion arch/lkl/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
16 changes: 1 addition & 15 deletions arch/lkl/kernel/threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include <asm/cpu.h>
#include <asm/sched.h>

static volatile int threads_counter;

static int init_ti(struct thread_info *ti)
{
ti->sched_sem = lkl_ops->sem_alloc(0);
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
Expand All @@ -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);
}

0 comments on commit cd60be9

Please sign in to comment.