diff options
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index bf0cef8bbdf2..4854c2c4a82e 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -817,17 +817,17 @@ static void posix_cpu_timers_init_group(struct signal_struct *sig) | |||
817 | static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) | 817 | static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) |
818 | { | 818 | { |
819 | struct signal_struct *sig; | 819 | struct signal_struct *sig; |
820 | int ret; | ||
821 | 820 | ||
822 | if (clone_flags & CLONE_THREAD) { | 821 | if (clone_flags & CLONE_THREAD) { |
823 | ret = thread_group_cputime_clone_thread(current); | 822 | atomic_inc(¤t->signal->count); |
824 | if (likely(!ret)) { | 823 | atomic_inc(¤t->signal->live); |
825 | atomic_inc(¤t->signal->count); | 824 | return 0; |
826 | atomic_inc(¤t->signal->live); | ||
827 | } | ||
828 | return ret; | ||
829 | } | 825 | } |
830 | sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL); | 826 | sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL); |
827 | |||
828 | if (sig) | ||
829 | posix_cpu_timers_init_group(sig); | ||
830 | |||
831 | tsk->signal = sig; | 831 | tsk->signal = sig; |
832 | if (!sig) | 832 | if (!sig) |
833 | return -ENOMEM; | 833 | return -ENOMEM; |
@@ -851,21 +851,20 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk) | |||
851 | sig->tty_old_pgrp = NULL; | 851 | sig->tty_old_pgrp = NULL; |
852 | sig->tty = NULL; | 852 | sig->tty = NULL; |
853 | 853 | ||
854 | sig->cutime = sig->cstime = cputime_zero; | 854 | sig->utime = sig->stime = sig->cutime = sig->cstime = cputime_zero; |
855 | sig->gtime = cputime_zero; | 855 | sig->gtime = cputime_zero; |
856 | sig->cgtime = cputime_zero; | 856 | sig->cgtime = cputime_zero; |
857 | sig->nvcsw = sig->nivcsw = sig->cnvcsw = sig->cnivcsw = 0; | 857 | sig->nvcsw = sig->nivcsw = sig->cnvcsw = sig->cnivcsw = 0; |
858 | sig->min_flt = sig->maj_flt = sig->cmin_flt = sig->cmaj_flt = 0; | 858 | sig->min_flt = sig->maj_flt = sig->cmin_flt = sig->cmaj_flt = 0; |
859 | sig->inblock = sig->oublock = sig->cinblock = sig->coublock = 0; | 859 | sig->inblock = sig->oublock = sig->cinblock = sig->coublock = 0; |
860 | task_io_accounting_init(&sig->ioac); | 860 | task_io_accounting_init(&sig->ioac); |
861 | sig->sum_sched_runtime = 0; | ||
861 | taskstats_tgid_init(sig); | 862 | taskstats_tgid_init(sig); |
862 | 863 | ||
863 | task_lock(current->group_leader); | 864 | task_lock(current->group_leader); |
864 | memcpy(sig->rlim, current->signal->rlim, sizeof sig->rlim); | 865 | memcpy(sig->rlim, current->signal->rlim, sizeof sig->rlim); |
865 | task_unlock(current->group_leader); | 866 | task_unlock(current->group_leader); |
866 | 867 | ||
867 | posix_cpu_timers_init_group(sig); | ||
868 | |||
869 | acct_init_pacct(&sig->pacct); | 868 | acct_init_pacct(&sig->pacct); |
870 | 869 | ||
871 | tty_audit_fork(sig); | 870 | tty_audit_fork(sig); |
@@ -1007,6 +1006,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1007 | * triggers too late. This doesn't hurt, the check is only there | 1006 | * triggers too late. This doesn't hurt, the check is only there |
1008 | * to stop root fork bombs. | 1007 | * to stop root fork bombs. |
1009 | */ | 1008 | */ |
1009 | retval = -EAGAIN; | ||
1010 | if (nr_threads >= max_threads) | 1010 | if (nr_threads >= max_threads) |
1011 | goto bad_fork_cleanup_count; | 1011 | goto bad_fork_cleanup_count; |
1012 | 1012 | ||
@@ -1095,7 +1095,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1095 | #ifdef CONFIG_DEBUG_MUTEXES | 1095 | #ifdef CONFIG_DEBUG_MUTEXES |
1096 | p->blocked_on = NULL; /* not blocked yet */ | 1096 | p->blocked_on = NULL; /* not blocked yet */ |
1097 | #endif | 1097 | #endif |
1098 | if (unlikely(ptrace_reparented(current))) | 1098 | if (unlikely(current->ptrace)) |
1099 | ptrace_fork(p, clone_flags); | 1099 | ptrace_fork(p, clone_flags); |
1100 | 1100 | ||
1101 | /* Perform scheduler related setup. Assign this task to a CPU. */ | 1101 | /* Perform scheduler related setup. Assign this task to a CPU. */ |
@@ -1179,10 +1179,6 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1179 | #endif | 1179 | #endif |
1180 | clear_all_latency_tracing(p); | 1180 | clear_all_latency_tracing(p); |
1181 | 1181 | ||
1182 | /* Our parent execution domain becomes current domain | ||
1183 | These must match for thread signalling to apply */ | ||
1184 | p->parent_exec_id = p->self_exec_id; | ||
1185 | |||
1186 | /* ok, now we should be set up.. */ | 1182 | /* ok, now we should be set up.. */ |
1187 | p->exit_signal = (clone_flags & CLONE_THREAD) ? -1 : (clone_flags & CSIGNAL); | 1183 | p->exit_signal = (clone_flags & CLONE_THREAD) ? -1 : (clone_flags & CSIGNAL); |
1188 | p->pdeath_signal = 0; | 1184 | p->pdeath_signal = 0; |
@@ -1220,10 +1216,13 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1220 | set_task_cpu(p, smp_processor_id()); | 1216 | set_task_cpu(p, smp_processor_id()); |
1221 | 1217 | ||
1222 | /* CLONE_PARENT re-uses the old parent */ | 1218 | /* CLONE_PARENT re-uses the old parent */ |
1223 | if (clone_flags & (CLONE_PARENT|CLONE_THREAD)) | 1219 | if (clone_flags & (CLONE_PARENT|CLONE_THREAD)) { |
1224 | p->real_parent = current->real_parent; | 1220 | p->real_parent = current->real_parent; |
1225 | else | 1221 | p->parent_exec_id = current->parent_exec_id; |
1222 | } else { | ||
1226 | p->real_parent = current; | 1223 | p->real_parent = current; |
1224 | p->parent_exec_id = current->self_exec_id; | ||
1225 | } | ||
1227 | 1226 | ||
1228 | spin_lock(¤t->sighand->siglock); | 1227 | spin_lock(¤t->sighand->siglock); |
1229 | 1228 | ||