aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index b058c5820ecd..051f090d40c1 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -76,6 +76,9 @@
76 76
77#include <trace/events/sched.h> 77#include <trace/events/sched.h>
78 78
79#define CREATE_TRACE_POINTS
80#include <trace/events/task.h>
81
79/* 82/*
80 * Protected counters by write_lock_irq(&tasklist_lock) 83 * Protected counters by write_lock_irq(&tasklist_lock)
81 */ 84 */
@@ -870,6 +873,7 @@ static int copy_io(unsigned long clone_flags, struct task_struct *tsk)
870{ 873{
871#ifdef CONFIG_BLOCK 874#ifdef CONFIG_BLOCK
872 struct io_context *ioc = current->io_context; 875 struct io_context *ioc = current->io_context;
876 struct io_context *new_ioc;
873 877
874 if (!ioc) 878 if (!ioc)
875 return 0; 879 return 0;
@@ -881,11 +885,12 @@ static int copy_io(unsigned long clone_flags, struct task_struct *tsk)
881 if (unlikely(!tsk->io_context)) 885 if (unlikely(!tsk->io_context))
882 return -ENOMEM; 886 return -ENOMEM;
883 } else if (ioprio_valid(ioc->ioprio)) { 887 } else if (ioprio_valid(ioc->ioprio)) {
884 tsk->io_context = alloc_io_context(GFP_KERNEL, -1); 888 new_ioc = get_task_io_context(tsk, GFP_KERNEL, NUMA_NO_NODE);
885 if (unlikely(!tsk->io_context)) 889 if (unlikely(!new_ioc))
886 return -ENOMEM; 890 return -ENOMEM;
887 891
888 tsk->io_context->ioprio = ioc->ioprio; 892 new_ioc->ioprio = ioc->ioprio;
893 put_io_context(new_ioc, NULL);
889 } 894 }
890#endif 895#endif
891 return 0; 896 return 0;
@@ -972,7 +977,7 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
972 sched_autogroup_fork(sig); 977 sched_autogroup_fork(sig);
973 978
974#ifdef CONFIG_CGROUPS 979#ifdef CONFIG_CGROUPS
975 init_rwsem(&sig->threadgroup_fork_lock); 980 init_rwsem(&sig->group_rwsem);
976#endif 981#endif
977 982
978 sig->oom_adj = current->signal->oom_adj; 983 sig->oom_adj = current->signal->oom_adj;
@@ -992,7 +997,6 @@ static void copy_flags(unsigned long clone_flags, struct task_struct *p)
992 new_flags |= PF_FORKNOEXEC; 997 new_flags |= PF_FORKNOEXEC;
993 new_flags |= PF_STARTING; 998 new_flags |= PF_STARTING;
994 p->flags = new_flags; 999 p->flags = new_flags;
995 clear_freeze_flag(p);
996} 1000}
997 1001
998SYSCALL_DEFINE1(set_tid_address, int __user *, tidptr) 1002SYSCALL_DEFINE1(set_tid_address, int __user *, tidptr)
@@ -1154,7 +1158,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1154 p->io_context = NULL; 1158 p->io_context = NULL;
1155 p->audit_context = NULL; 1159 p->audit_context = NULL;
1156 if (clone_flags & CLONE_THREAD) 1160 if (clone_flags & CLONE_THREAD)
1157 threadgroup_fork_read_lock(current); 1161 threadgroup_change_begin(current);
1158 cgroup_fork(p); 1162 cgroup_fork(p);
1159#ifdef CONFIG_NUMA 1163#ifdef CONFIG_NUMA
1160 p->mempolicy = mpol_dup(p->mempolicy); 1164 p->mempolicy = mpol_dup(p->mempolicy);
@@ -1292,6 +1296,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1292 1296
1293 p->nr_dirtied = 0; 1297 p->nr_dirtied = 0;
1294 p->nr_dirtied_pause = 128 >> (PAGE_SHIFT - 10); 1298 p->nr_dirtied_pause = 128 >> (PAGE_SHIFT - 10);
1299 p->dirty_paused_when = 0;
1295 1300
1296 /* 1301 /*
1297 * Ok, make it visible to the rest of the system. 1302 * Ok, make it visible to the rest of the system.
@@ -1369,8 +1374,11 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1369 proc_fork_connector(p); 1374 proc_fork_connector(p);
1370 cgroup_post_fork(p); 1375 cgroup_post_fork(p);
1371 if (clone_flags & CLONE_THREAD) 1376 if (clone_flags & CLONE_THREAD)
1372 threadgroup_fork_read_unlock(current); 1377 threadgroup_change_end(current);
1373 perf_event_fork(p); 1378 perf_event_fork(p);
1379
1380 trace_task_newtask(p, clone_flags);
1381
1374 return p; 1382 return p;
1375 1383
1376bad_fork_free_pid: 1384bad_fork_free_pid:
@@ -1404,7 +1412,7 @@ bad_fork_cleanup_policy:
1404bad_fork_cleanup_cgroup: 1412bad_fork_cleanup_cgroup:
1405#endif 1413#endif
1406 if (clone_flags & CLONE_THREAD) 1414 if (clone_flags & CLONE_THREAD)
1407 threadgroup_fork_read_unlock(current); 1415 threadgroup_change_end(current);
1408 cgroup_exit(p, cgroup_callbacks_done); 1416 cgroup_exit(p, cgroup_callbacks_done);
1409 delayacct_tsk_free(p); 1417 delayacct_tsk_free(p);
1410 module_put(task_thread_info(p)->exec_domain->module); 1418 module_put(task_thread_info(p)->exec_domain->module);
@@ -1519,8 +1527,6 @@ long do_fork(unsigned long clone_flags,
1519 init_completion(&vfork); 1527 init_completion(&vfork);
1520 } 1528 }
1521 1529
1522 audit_finish_fork(p);
1523
1524 /* 1530 /*
1525 * We set PF_STARTING at creation in case tracing wants to 1531 * We set PF_STARTING at creation in case tracing wants to
1526 * use this to distinguish a fully live task from one that 1532 * use this to distinguish a fully live task from one that