diff options
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index bd2959228871..021e1138556e 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -426,6 +426,7 @@ static struct mm_struct * mm_init(struct mm_struct * mm, struct task_struct *p) | |||
426 | init_rwsem(&mm->mmap_sem); | 426 | init_rwsem(&mm->mmap_sem); |
427 | INIT_LIST_HEAD(&mm->mmlist); | 427 | INIT_LIST_HEAD(&mm->mmlist); |
428 | mm->flags = (current->mm) ? current->mm->flags : default_dump_filter; | 428 | mm->flags = (current->mm) ? current->mm->flags : default_dump_filter; |
429 | mm->oom_adj = (current->mm) ? current->mm->oom_adj : 0; | ||
429 | mm->core_state = NULL; | 430 | mm->core_state = NULL; |
430 | mm->nr_ptes = 0; | 431 | mm->nr_ptes = 0; |
431 | set_mm_counter(mm, file_rss, 0); | 432 | set_mm_counter(mm, file_rss, 0); |
@@ -567,18 +568,18 @@ void mm_release(struct task_struct *tsk, struct mm_struct *mm) | |||
567 | * the value intact in a core dump, and to save the unnecessary | 568 | * the value intact in a core dump, and to save the unnecessary |
568 | * trouble otherwise. Userland only wants this done for a sys_exit. | 569 | * trouble otherwise. Userland only wants this done for a sys_exit. |
569 | */ | 570 | */ |
570 | if (tsk->clear_child_tid | 571 | if (tsk->clear_child_tid) { |
571 | && !(tsk->flags & PF_SIGNALED) | 572 | if (!(tsk->flags & PF_SIGNALED) && |
572 | && atomic_read(&mm->mm_users) > 1) { | 573 | atomic_read(&mm->mm_users) > 1) { |
573 | u32 __user * tidptr = tsk->clear_child_tid; | 574 | /* |
575 | * We don't check the error code - if userspace has | ||
576 | * not set up a proper pointer then tough luck. | ||
577 | */ | ||
578 | put_user(0, tsk->clear_child_tid); | ||
579 | sys_futex(tsk->clear_child_tid, FUTEX_WAKE, | ||
580 | 1, NULL, NULL, 0); | ||
581 | } | ||
574 | tsk->clear_child_tid = NULL; | 582 | tsk->clear_child_tid = NULL; |
575 | |||
576 | /* | ||
577 | * We don't check the error code - if userspace has | ||
578 | * not set up a proper pointer then tough luck. | ||
579 | */ | ||
580 | put_user(0, tidptr); | ||
581 | sys_futex(tidptr, FUTEX_WAKE, 1, NULL, NULL, 0); | ||
582 | } | 583 | } |
583 | } | 584 | } |
584 | 585 | ||
@@ -1268,6 +1269,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1268 | write_unlock_irq(&tasklist_lock); | 1269 | write_unlock_irq(&tasklist_lock); |
1269 | proc_fork_connector(p); | 1270 | proc_fork_connector(p); |
1270 | cgroup_post_fork(p); | 1271 | cgroup_post_fork(p); |
1272 | perf_counter_fork(p); | ||
1271 | return p; | 1273 | return p; |
1272 | 1274 | ||
1273 | bad_fork_free_pid: | 1275 | bad_fork_free_pid: |
@@ -1407,12 +1409,6 @@ long do_fork(unsigned long clone_flags, | |||
1407 | if (clone_flags & CLONE_VFORK) { | 1409 | if (clone_flags & CLONE_VFORK) { |
1408 | p->vfork_done = &vfork; | 1410 | p->vfork_done = &vfork; |
1409 | init_completion(&vfork); | 1411 | init_completion(&vfork); |
1410 | } else if (!(clone_flags & CLONE_VM)) { | ||
1411 | /* | ||
1412 | * vfork will do an exec which will call | ||
1413 | * set_task_comm() | ||
1414 | */ | ||
1415 | perf_counter_fork(p); | ||
1416 | } | 1412 | } |
1417 | 1413 | ||
1418 | audit_finish_fork(p); | 1414 | audit_finish_fork(p); |