diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-01-10 20:42:53 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-10 20:42:53 -0500 |
commit | 506c10f26c481b7f8ef27c1c79290f68989b2e9e (patch) | |
tree | 03de82e812f00957aa6276dac2fe51c3358e88d7 /kernel/fork.c | |
parent | e1df957670aef74ffd9a4ad93e6d2c90bf6b4845 (diff) | |
parent | c59765042f53a79a7a65585042ff463b69cb248c (diff) |
Merge commit 'v2.6.29-rc1' into perfcounters/core
Conflicts:
include/linux/kernel_stat.h
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index cb706599057f..b1f8609287eb 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -400,6 +400,18 @@ __cacheline_aligned_in_smp DEFINE_SPINLOCK(mmlist_lock); | |||
400 | #define allocate_mm() (kmem_cache_alloc(mm_cachep, GFP_KERNEL)) | 400 | #define allocate_mm() (kmem_cache_alloc(mm_cachep, GFP_KERNEL)) |
401 | #define free_mm(mm) (kmem_cache_free(mm_cachep, (mm))) | 401 | #define free_mm(mm) (kmem_cache_free(mm_cachep, (mm))) |
402 | 402 | ||
403 | static unsigned long default_dump_filter = MMF_DUMP_FILTER_DEFAULT; | ||
404 | |||
405 | static int __init coredump_filter_setup(char *s) | ||
406 | { | ||
407 | default_dump_filter = | ||
408 | (simple_strtoul(s, NULL, 0) << MMF_DUMP_FILTER_SHIFT) & | ||
409 | MMF_DUMP_FILTER_MASK; | ||
410 | return 1; | ||
411 | } | ||
412 | |||
413 | __setup("coredump_filter=", coredump_filter_setup); | ||
414 | |||
403 | #include <linux/init_task.h> | 415 | #include <linux/init_task.h> |
404 | 416 | ||
405 | static struct mm_struct * mm_init(struct mm_struct * mm, struct task_struct *p) | 417 | static struct mm_struct * mm_init(struct mm_struct * mm, struct task_struct *p) |
@@ -408,15 +420,14 @@ static struct mm_struct * mm_init(struct mm_struct * mm, struct task_struct *p) | |||
408 | atomic_set(&mm->mm_count, 1); | 420 | atomic_set(&mm->mm_count, 1); |
409 | init_rwsem(&mm->mmap_sem); | 421 | init_rwsem(&mm->mmap_sem); |
410 | INIT_LIST_HEAD(&mm->mmlist); | 422 | INIT_LIST_HEAD(&mm->mmlist); |
411 | mm->flags = (current->mm) ? current->mm->flags | 423 | mm->flags = (current->mm) ? current->mm->flags : default_dump_filter; |
412 | : MMF_DUMP_FILTER_DEFAULT; | ||
413 | mm->core_state = NULL; | 424 | mm->core_state = NULL; |
414 | mm->nr_ptes = 0; | 425 | mm->nr_ptes = 0; |
415 | set_mm_counter(mm, file_rss, 0); | 426 | set_mm_counter(mm, file_rss, 0); |
416 | set_mm_counter(mm, anon_rss, 0); | 427 | set_mm_counter(mm, anon_rss, 0); |
417 | spin_lock_init(&mm->page_table_lock); | 428 | spin_lock_init(&mm->page_table_lock); |
418 | rwlock_init(&mm->ioctx_list_lock); | 429 | spin_lock_init(&mm->ioctx_lock); |
419 | mm->ioctx_list = NULL; | 430 | INIT_HLIST_HEAD(&mm->ioctx_list); |
420 | mm->free_area_cache = TASK_UNMAPPED_BASE; | 431 | mm->free_area_cache = TASK_UNMAPPED_BASE; |
421 | mm->cached_hole_size = ~0UL; | 432 | mm->cached_hole_size = ~0UL; |
422 | mm_init_owner(mm, p); | 433 | mm_init_owner(mm, p); |
@@ -758,7 +769,7 @@ static int copy_sighand(unsigned long clone_flags, struct task_struct *tsk) | |||
758 | { | 769 | { |
759 | struct sighand_struct *sig; | 770 | struct sighand_struct *sig; |
760 | 771 | ||
761 | if (clone_flags & (CLONE_SIGHAND | CLONE_THREAD)) { | 772 | if (clone_flags & CLONE_SIGHAND) { |
762 | atomic_inc(¤t->sighand->count); | 773 | atomic_inc(¤t->sighand->count); |
763 | return 0; | 774 | return 0; |
764 | } | 775 | } |
@@ -1116,12 +1127,12 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1116 | 1127 | ||
1117 | if (pid != &init_struct_pid) { | 1128 | if (pid != &init_struct_pid) { |
1118 | retval = -ENOMEM; | 1129 | retval = -ENOMEM; |
1119 | pid = alloc_pid(task_active_pid_ns(p)); | 1130 | pid = alloc_pid(p->nsproxy->pid_ns); |
1120 | if (!pid) | 1131 | if (!pid) |
1121 | goto bad_fork_cleanup_io; | 1132 | goto bad_fork_cleanup_io; |
1122 | 1133 | ||
1123 | if (clone_flags & CLONE_NEWPID) { | 1134 | if (clone_flags & CLONE_NEWPID) { |
1124 | retval = pid_ns_prepare_proc(task_active_pid_ns(p)); | 1135 | retval = pid_ns_prepare_proc(p->nsproxy->pid_ns); |
1125 | if (retval < 0) | 1136 | if (retval < 0) |
1126 | goto bad_fork_free_pid; | 1137 | goto bad_fork_free_pid; |
1127 | } | 1138 | } |
@@ -1471,12 +1482,10 @@ void __init proc_caches_init(void) | |||
1471 | fs_cachep = kmem_cache_create("fs_cache", | 1482 | fs_cachep = kmem_cache_create("fs_cache", |
1472 | sizeof(struct fs_struct), 0, | 1483 | sizeof(struct fs_struct), 0, |
1473 | SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); | 1484 | SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); |
1474 | vm_area_cachep = kmem_cache_create("vm_area_struct", | ||
1475 | sizeof(struct vm_area_struct), 0, | ||
1476 | SLAB_PANIC, NULL); | ||
1477 | mm_cachep = kmem_cache_create("mm_struct", | 1485 | mm_cachep = kmem_cache_create("mm_struct", |
1478 | sizeof(struct mm_struct), ARCH_MIN_MMSTRUCT_ALIGN, | 1486 | sizeof(struct mm_struct), ARCH_MIN_MMSTRUCT_ALIGN, |
1479 | SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); | 1487 | SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); |
1488 | mmap_init(); | ||
1480 | } | 1489 | } |
1481 | 1490 | ||
1482 | /* | 1491 | /* |