diff options
author | Len Brown <len.brown@intel.com> | 2006-01-27 17:18:29 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2006-01-27 17:18:29 -0500 |
commit | 292dd876ee765c478b27c93cc51e93a558ed58bf (patch) | |
tree | 5b740e93253295baee2a9c414a6c66d03d44a9ef /kernel/fork.c | |
parent | d4ec6c7cc9a15a7a529719bc3b84f46812f9842e (diff) | |
parent | 9fdb62af92c741addbea15545f214a6e89460865 (diff) |
Pull release into acpica branch
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index fb8572a42297..4ae8cfc1c89c 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/binfmts.h> | 28 | #include <linux/binfmts.h> |
29 | #include <linux/mman.h> | 29 | #include <linux/mman.h> |
30 | #include <linux/fs.h> | 30 | #include <linux/fs.h> |
31 | #include <linux/capability.h> | ||
31 | #include <linux/cpu.h> | 32 | #include <linux/cpu.h> |
32 | #include <linux/cpuset.h> | 33 | #include <linux/cpuset.h> |
33 | #include <linux/security.h> | 34 | #include <linux/security.h> |
@@ -743,6 +744,14 @@ int unshare_files(void) | |||
743 | 744 | ||
744 | EXPORT_SYMBOL(unshare_files); | 745 | EXPORT_SYMBOL(unshare_files); |
745 | 746 | ||
747 | void sighand_free_cb(struct rcu_head *rhp) | ||
748 | { | ||
749 | struct sighand_struct *sp; | ||
750 | |||
751 | sp = container_of(rhp, struct sighand_struct, rcu); | ||
752 | kmem_cache_free(sighand_cachep, sp); | ||
753 | } | ||
754 | |||
746 | static inline int copy_sighand(unsigned long clone_flags, struct task_struct * tsk) | 755 | static inline int copy_sighand(unsigned long clone_flags, struct task_struct * tsk) |
747 | { | 756 | { |
748 | struct sighand_struct *sig; | 757 | struct sighand_struct *sig; |
@@ -752,7 +761,7 @@ static inline int copy_sighand(unsigned long clone_flags, struct task_struct * t | |||
752 | return 0; | 761 | return 0; |
753 | } | 762 | } |
754 | sig = kmem_cache_alloc(sighand_cachep, GFP_KERNEL); | 763 | sig = kmem_cache_alloc(sighand_cachep, GFP_KERNEL); |
755 | tsk->sighand = sig; | 764 | rcu_assign_pointer(tsk->sighand, sig); |
756 | if (!sig) | 765 | if (!sig) |
757 | return -ENOMEM; | 766 | return -ENOMEM; |
758 | spin_lock_init(&sig->siglock); | 767 | spin_lock_init(&sig->siglock); |
@@ -793,19 +802,16 @@ static inline int copy_signal(unsigned long clone_flags, struct task_struct * ts | |||
793 | init_sigpending(&sig->shared_pending); | 802 | init_sigpending(&sig->shared_pending); |
794 | INIT_LIST_HEAD(&sig->posix_timers); | 803 | INIT_LIST_HEAD(&sig->posix_timers); |
795 | 804 | ||
796 | sig->it_real_value = sig->it_real_incr = 0; | 805 | hrtimer_init(&sig->real_timer, CLOCK_MONOTONIC); |
806 | sig->it_real_incr.tv64 = 0; | ||
797 | sig->real_timer.function = it_real_fn; | 807 | sig->real_timer.function = it_real_fn; |
798 | sig->real_timer.data = (unsigned long) tsk; | 808 | sig->real_timer.data = tsk; |
799 | init_timer(&sig->real_timer); | ||
800 | 809 | ||
801 | sig->it_virt_expires = cputime_zero; | 810 | sig->it_virt_expires = cputime_zero; |
802 | sig->it_virt_incr = cputime_zero; | 811 | sig->it_virt_incr = cputime_zero; |
803 | sig->it_prof_expires = cputime_zero; | 812 | sig->it_prof_expires = cputime_zero; |
804 | sig->it_prof_incr = cputime_zero; | 813 | sig->it_prof_incr = cputime_zero; |
805 | 814 | ||
806 | sig->tty = current->signal->tty; | ||
807 | sig->pgrp = process_group(current); | ||
808 | sig->session = current->signal->session; | ||
809 | sig->leader = 0; /* session leadership doesn't inherit */ | 815 | sig->leader = 0; /* session leadership doesn't inherit */ |
810 | sig->tty_old_pgrp = 0; | 816 | sig->tty_old_pgrp = 0; |
811 | 817 | ||
@@ -964,15 +970,20 @@ static task_t *copy_process(unsigned long clone_flags, | |||
964 | p->io_context = NULL; | 970 | p->io_context = NULL; |
965 | p->io_wait = NULL; | 971 | p->io_wait = NULL; |
966 | p->audit_context = NULL; | 972 | p->audit_context = NULL; |
973 | cpuset_fork(p); | ||
967 | #ifdef CONFIG_NUMA | 974 | #ifdef CONFIG_NUMA |
968 | p->mempolicy = mpol_copy(p->mempolicy); | 975 | p->mempolicy = mpol_copy(p->mempolicy); |
969 | if (IS_ERR(p->mempolicy)) { | 976 | if (IS_ERR(p->mempolicy)) { |
970 | retval = PTR_ERR(p->mempolicy); | 977 | retval = PTR_ERR(p->mempolicy); |
971 | p->mempolicy = NULL; | 978 | p->mempolicy = NULL; |
972 | goto bad_fork_cleanup; | 979 | goto bad_fork_cleanup_cpuset; |
973 | } | 980 | } |
974 | #endif | 981 | #endif |
975 | 982 | ||
983 | #ifdef CONFIG_DEBUG_MUTEXES | ||
984 | p->blocked_on = NULL; /* not blocked yet */ | ||
985 | #endif | ||
986 | |||
976 | p->tgid = p->pid; | 987 | p->tgid = p->pid; |
977 | if (clone_flags & CLONE_THREAD) | 988 | if (clone_flags & CLONE_THREAD) |
978 | p->tgid = current->tgid; | 989 | p->tgid = current->tgid; |
@@ -1127,25 +1138,19 @@ static task_t *copy_process(unsigned long clone_flags, | |||
1127 | attach_pid(p, PIDTYPE_PID, p->pid); | 1138 | attach_pid(p, PIDTYPE_PID, p->pid); |
1128 | attach_pid(p, PIDTYPE_TGID, p->tgid); | 1139 | attach_pid(p, PIDTYPE_TGID, p->tgid); |
1129 | if (thread_group_leader(p)) { | 1140 | if (thread_group_leader(p)) { |
1141 | p->signal->tty = current->signal->tty; | ||
1142 | p->signal->pgrp = process_group(current); | ||
1143 | p->signal->session = current->signal->session; | ||
1130 | attach_pid(p, PIDTYPE_PGID, process_group(p)); | 1144 | attach_pid(p, PIDTYPE_PGID, process_group(p)); |
1131 | attach_pid(p, PIDTYPE_SID, p->signal->session); | 1145 | attach_pid(p, PIDTYPE_SID, p->signal->session); |
1132 | if (p->pid) | 1146 | if (p->pid) |
1133 | __get_cpu_var(process_counts)++; | 1147 | __get_cpu_var(process_counts)++; |
1134 | } | 1148 | } |
1135 | 1149 | ||
1136 | if (!current->signal->tty && p->signal->tty) | ||
1137 | p->signal->tty = NULL; | ||
1138 | |||
1139 | nr_threads++; | 1150 | nr_threads++; |
1140 | total_forks++; | 1151 | total_forks++; |
1141 | write_unlock_irq(&tasklist_lock); | 1152 | write_unlock_irq(&tasklist_lock); |
1142 | proc_fork_connector(p); | 1153 | proc_fork_connector(p); |
1143 | cpuset_fork(p); | ||
1144 | retval = 0; | ||
1145 | |||
1146 | fork_out: | ||
1147 | if (retval) | ||
1148 | return ERR_PTR(retval); | ||
1149 | return p; | 1154 | return p; |
1150 | 1155 | ||
1151 | bad_fork_cleanup_namespace: | 1156 | bad_fork_cleanup_namespace: |
@@ -1172,7 +1177,9 @@ bad_fork_cleanup_security: | |||
1172 | bad_fork_cleanup_policy: | 1177 | bad_fork_cleanup_policy: |
1173 | #ifdef CONFIG_NUMA | 1178 | #ifdef CONFIG_NUMA |
1174 | mpol_free(p->mempolicy); | 1179 | mpol_free(p->mempolicy); |
1180 | bad_fork_cleanup_cpuset: | ||
1175 | #endif | 1181 | #endif |
1182 | cpuset_exit(p); | ||
1176 | bad_fork_cleanup: | 1183 | bad_fork_cleanup: |
1177 | if (p->binfmt) | 1184 | if (p->binfmt) |
1178 | module_put(p->binfmt->module); | 1185 | module_put(p->binfmt->module); |
@@ -1184,7 +1191,8 @@ bad_fork_cleanup_count: | |||
1184 | free_uid(p->user); | 1191 | free_uid(p->user); |
1185 | bad_fork_free: | 1192 | bad_fork_free: |
1186 | free_task(p); | 1193 | free_task(p); |
1187 | goto fork_out; | 1194 | fork_out: |
1195 | return ERR_PTR(retval); | ||
1188 | } | 1196 | } |
1189 | 1197 | ||
1190 | struct pt_regs * __devinit __attribute__((weak)) idle_regs(struct pt_regs *regs) | 1198 | struct pt_regs * __devinit __attribute__((weak)) idle_regs(struct pt_regs *regs) |
@@ -1290,6 +1298,10 @@ long do_fork(unsigned long clone_flags, | |||
1290 | return pid; | 1298 | return pid; |
1291 | } | 1299 | } |
1292 | 1300 | ||
1301 | #ifndef ARCH_MIN_MMSTRUCT_ALIGN | ||
1302 | #define ARCH_MIN_MMSTRUCT_ALIGN 0 | ||
1303 | #endif | ||
1304 | |||
1293 | void __init proc_caches_init(void) | 1305 | void __init proc_caches_init(void) |
1294 | { | 1306 | { |
1295 | sighand_cachep = kmem_cache_create("sighand_cache", | 1307 | sighand_cachep = kmem_cache_create("sighand_cache", |
@@ -1308,6 +1320,6 @@ void __init proc_caches_init(void) | |||
1308 | sizeof(struct vm_area_struct), 0, | 1320 | sizeof(struct vm_area_struct), 0, |
1309 | SLAB_PANIC, NULL, NULL); | 1321 | SLAB_PANIC, NULL, NULL); |
1310 | mm_cachep = kmem_cache_create("mm_struct", | 1322 | mm_cachep = kmem_cache_create("mm_struct", |
1311 | sizeof(struct mm_struct), 0, | 1323 | sizeof(struct mm_struct), ARCH_MIN_MMSTRUCT_ALIGN, |
1312 | SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL); | 1324 | SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL); |
1313 | } | 1325 | } |