diff options
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 47 |
1 files changed, 9 insertions, 38 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index b0ec34abc0bb..4799c5f0e6d0 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -86,7 +86,14 @@ int max_threads; /* tunable limit on nr_threads */ | |||
86 | DEFINE_PER_CPU(unsigned long, process_counts) = 0; | 86 | DEFINE_PER_CPU(unsigned long, process_counts) = 0; |
87 | 87 | ||
88 | __cacheline_aligned DEFINE_RWLOCK(tasklist_lock); /* outer */ | 88 | __cacheline_aligned DEFINE_RWLOCK(tasklist_lock); /* outer */ |
89 | EXPORT_SYMBOL_GPL(tasklist_lock); | 89 | |
90 | #ifdef CONFIG_PROVE_RCU | ||
91 | int lockdep_tasklist_lock_is_held(void) | ||
92 | { | ||
93 | return lockdep_is_held(&tasklist_lock); | ||
94 | } | ||
95 | EXPORT_SYMBOL_GPL(lockdep_tasklist_lock_is_held); | ||
96 | #endif /* #ifdef CONFIG_PROVE_RCU */ | ||
90 | 97 | ||
91 | int nr_processes(void) | 98 | int nr_processes(void) |
92 | { | 99 | { |
@@ -833,17 +840,6 @@ static void posix_cpu_timers_init_group(struct signal_struct *sig) | |||
833 | /* Thread group counters. */ | 840 | /* Thread group counters. */ |
834 | thread_group_cputime_init(sig); | 841 | thread_group_cputime_init(sig); |
835 | 842 | ||
836 | /* Expiration times and increments. */ | ||
837 | sig->it[CPUCLOCK_PROF].expires = cputime_zero; | ||
838 | sig->it[CPUCLOCK_PROF].incr = cputime_zero; | ||
839 | sig->it[CPUCLOCK_VIRT].expires = cputime_zero; | ||
840 | sig->it[CPUCLOCK_VIRT].incr = cputime_zero; | ||
841 | |||
842 | /* Cached expiration times. */ | ||
843 | sig->cputime_expires.prof_exp = cputime_zero; | ||
844 | sig->cputime_expires.virt_exp = cputime_zero; | ||
845 | sig->cputime_expires.sched_exp = 0; | ||
846 | |||
847 | cpu_limit = ACCESS_ONCE(sig->rlim[RLIMIT_CPU].rlim_cur); | 843 | cpu_limit = ACCESS_ONCE(sig->rlim[RLIMIT_CPU].rlim_cur); |
848 | if (cpu_limit != RLIM_INFINITY) { | 844 | if (cpu_limit != RLIM_INFINITY) { |
849 | sig->cputime_expires.prof_exp = secs_to_cputime(cpu_limit); | 845 | sig->cputime_expires.prof_exp = secs_to_cputime(cpu_limit); |
@@ -863,7 +859,7 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) | |||
863 | if (clone_flags & CLONE_THREAD) | 859 | if (clone_flags & CLONE_THREAD) |
864 | return 0; | 860 | return 0; |
865 | 861 | ||
866 | sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL); | 862 | sig = kmem_cache_zalloc(signal_cachep, GFP_KERNEL); |
867 | tsk->signal = sig; | 863 | tsk->signal = sig; |
868 | if (!sig) | 864 | if (!sig) |
869 | return -ENOMEM; | 865 | return -ENOMEM; |
@@ -871,46 +867,21 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) | |||
871 | atomic_set(&sig->count, 1); | 867 | atomic_set(&sig->count, 1); |
872 | atomic_set(&sig->live, 1); | 868 | atomic_set(&sig->live, 1); |
873 | init_waitqueue_head(&sig->wait_chldexit); | 869 | init_waitqueue_head(&sig->wait_chldexit); |
874 | sig->flags = 0; | ||
875 | if (clone_flags & CLONE_NEWPID) | 870 | if (clone_flags & CLONE_NEWPID) |
876 | sig->flags |= SIGNAL_UNKILLABLE; | 871 | sig->flags |= SIGNAL_UNKILLABLE; |
877 | sig->group_exit_code = 0; | ||
878 | sig->group_exit_task = NULL; | ||
879 | sig->group_stop_count = 0; | ||
880 | sig->curr_target = tsk; | 872 | sig->curr_target = tsk; |
881 | init_sigpending(&sig->shared_pending); | 873 | init_sigpending(&sig->shared_pending); |
882 | INIT_LIST_HEAD(&sig->posix_timers); | 874 | INIT_LIST_HEAD(&sig->posix_timers); |
883 | 875 | ||
884 | hrtimer_init(&sig->real_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | 876 | hrtimer_init(&sig->real_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
885 | sig->it_real_incr.tv64 = 0; | ||
886 | sig->real_timer.function = it_real_fn; | 877 | sig->real_timer.function = it_real_fn; |
887 | 878 | ||
888 | sig->leader = 0; /* session leadership doesn't inherit */ | ||
889 | sig->tty_old_pgrp = NULL; | ||
890 | sig->tty = NULL; | ||
891 | |||
892 | sig->utime = sig->stime = sig->cutime = sig->cstime = cputime_zero; | ||
893 | sig->gtime = cputime_zero; | ||
894 | sig->cgtime = cputime_zero; | ||
895 | #ifndef CONFIG_VIRT_CPU_ACCOUNTING | ||
896 | sig->prev_utime = sig->prev_stime = cputime_zero; | ||
897 | #endif | ||
898 | sig->nvcsw = sig->nivcsw = sig->cnvcsw = sig->cnivcsw = 0; | ||
899 | sig->min_flt = sig->maj_flt = sig->cmin_flt = sig->cmaj_flt = 0; | ||
900 | sig->inblock = sig->oublock = sig->cinblock = sig->coublock = 0; | ||
901 | sig->maxrss = sig->cmaxrss = 0; | ||
902 | task_io_accounting_init(&sig->ioac); | ||
903 | sig->sum_sched_runtime = 0; | ||
904 | taskstats_tgid_init(sig); | ||
905 | |||
906 | task_lock(current->group_leader); | 879 | task_lock(current->group_leader); |
907 | memcpy(sig->rlim, current->signal->rlim, sizeof sig->rlim); | 880 | memcpy(sig->rlim, current->signal->rlim, sizeof sig->rlim); |
908 | task_unlock(current->group_leader); | 881 | task_unlock(current->group_leader); |
909 | 882 | ||
910 | posix_cpu_timers_init_group(sig); | 883 | posix_cpu_timers_init_group(sig); |
911 | 884 | ||
912 | acct_init_pacct(&sig->pacct); | ||
913 | |||
914 | tty_audit_fork(sig); | 885 | tty_audit_fork(sig); |
915 | 886 | ||
916 | sig->oom_adj = current->signal->oom_adj; | 887 | sig->oom_adj = current->signal->oom_adj; |