aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 0c32e28cdc5f..33ffb5bf0dbc 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -786,14 +786,6 @@ int unshare_files(void)
786 786
787EXPORT_SYMBOL(unshare_files); 787EXPORT_SYMBOL(unshare_files);
788 788
789void sighand_free_cb(struct rcu_head *rhp)
790{
791 struct sighand_struct *sp;
792
793 sp = container_of(rhp, struct sighand_struct, rcu);
794 kmem_cache_free(sighand_cachep, sp);
795}
796
797static inline int copy_sighand(unsigned long clone_flags, struct task_struct * tsk) 789static inline int copy_sighand(unsigned long clone_flags, struct task_struct * tsk)
798{ 790{
799 struct sighand_struct *sig; 791 struct sighand_struct *sig;
@@ -806,7 +798,6 @@ static inline int copy_sighand(unsigned long clone_flags, struct task_struct * t
806 rcu_assign_pointer(tsk->sighand, sig); 798 rcu_assign_pointer(tsk->sighand, sig);
807 if (!sig) 799 if (!sig)
808 return -ENOMEM; 800 return -ENOMEM;
809 spin_lock_init(&sig->siglock);
810 atomic_set(&sig->count, 1); 801 atomic_set(&sig->count, 1);
811 memcpy(sig->action, current->sighand->action, sizeof(sig->action)); 802 memcpy(sig->action, current->sighand->action, sizeof(sig->action));
812 return 0; 803 return 0;
@@ -1356,11 +1347,21 @@ long do_fork(unsigned long clone_flags,
1356#define ARCH_MIN_MMSTRUCT_ALIGN 0 1347#define ARCH_MIN_MMSTRUCT_ALIGN 0
1357#endif 1348#endif
1358 1349
1350static void sighand_ctor(void *data, kmem_cache_t *cachep, unsigned long flags)
1351{
1352 struct sighand_struct *sighand = data;
1353
1354 if ((flags & (SLAB_CTOR_VERIFY | SLAB_CTOR_CONSTRUCTOR)) ==
1355 SLAB_CTOR_CONSTRUCTOR)
1356 spin_lock_init(&sighand->siglock);
1357}
1358
1359void __init proc_caches_init(void) 1359void __init proc_caches_init(void)
1360{ 1360{
1361 sighand_cachep = kmem_cache_create("sighand_cache", 1361 sighand_cachep = kmem_cache_create("sighand_cache",
1362 sizeof(struct sighand_struct), 0, 1362 sizeof(struct sighand_struct), 0,
1363 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL); 1363 SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_DESTROY_BY_RCU,
1364 sighand_ctor, NULL);
1364 signal_cachep = kmem_cache_create("signal_cache", 1365 signal_cachep = kmem_cache_create("signal_cache",
1365 sizeof(struct signal_struct), 0, 1366 sizeof(struct signal_struct), 0,
1366 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL); 1367 SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);