aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 54a8d26f612f..d2799d1fc952 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -150,15 +150,15 @@ void __weak arch_release_thread_info(struct thread_info *ti)
150static struct thread_info *alloc_thread_info_node(struct task_struct *tsk, 150static struct thread_info *alloc_thread_info_node(struct task_struct *tsk,
151 int node) 151 int node)
152{ 152{
153 struct page *page = alloc_pages_node(node, THREADINFO_GFP_ACCOUNTED, 153 struct page *page = alloc_kmem_pages_node(node, THREADINFO_GFP,
154 THREAD_SIZE_ORDER); 154 THREAD_SIZE_ORDER);
155 155
156 return page ? page_address(page) : NULL; 156 return page ? page_address(page) : NULL;
157} 157}
158 158
159static inline void free_thread_info(struct thread_info *ti) 159static inline void free_thread_info(struct thread_info *ti)
160{ 160{
161 free_memcg_kmem_pages((unsigned long)ti, THREAD_SIZE_ORDER); 161 free_kmem_pages((unsigned long)ti, THREAD_SIZE_ORDER);
162} 162}
163# else 163# else
164static struct kmem_cache *thread_info_cache; 164static struct kmem_cache *thread_info_cache;
@@ -1099,12 +1099,12 @@ static void rt_mutex_init_task(struct task_struct *p)
1099#endif 1099#endif
1100} 1100}
1101 1101
1102#ifdef CONFIG_MM_OWNER 1102#ifdef CONFIG_MEMCG
1103void mm_init_owner(struct mm_struct *mm, struct task_struct *p) 1103void mm_init_owner(struct mm_struct *mm, struct task_struct *p)
1104{ 1104{
1105 mm->owner = p; 1105 mm->owner = p;
1106} 1106}
1107#endif /* CONFIG_MM_OWNER */ 1107#endif /* CONFIG_MEMCG */
1108 1108
1109/* 1109/*
1110 * Initialize POSIX timer handling for a single task. 1110 * Initialize POSIX timer handling for a single task.
@@ -1606,10 +1606,12 @@ long do_fork(unsigned long clone_flags,
1606 */ 1606 */
1607 if (!IS_ERR(p)) { 1607 if (!IS_ERR(p)) {
1608 struct completion vfork; 1608 struct completion vfork;
1609 struct pid *pid;
1609 1610
1610 trace_sched_process_fork(current, p); 1611 trace_sched_process_fork(current, p);
1611 1612
1612 nr = task_pid_vnr(p); 1613 pid = get_task_pid(p, PIDTYPE_PID);
1614 nr = pid_vnr(pid);
1613 1615
1614 if (clone_flags & CLONE_PARENT_SETTID) 1616 if (clone_flags & CLONE_PARENT_SETTID)
1615 put_user(nr, parent_tidptr); 1617 put_user(nr, parent_tidptr);
@@ -1624,12 +1626,14 @@ long do_fork(unsigned long clone_flags,
1624 1626
1625 /* forking complete and child started to run, tell ptracer */ 1627 /* forking complete and child started to run, tell ptracer */
1626 if (unlikely(trace)) 1628 if (unlikely(trace))
1627 ptrace_event(trace, nr); 1629 ptrace_event_pid(trace, pid);
1628 1630
1629 if (clone_flags & CLONE_VFORK) { 1631 if (clone_flags & CLONE_VFORK) {
1630 if (!wait_for_vfork_done(p, &vfork)) 1632 if (!wait_for_vfork_done(p, &vfork))
1631 ptrace_event(PTRACE_EVENT_VFORK_DONE, nr); 1633 ptrace_event_pid(PTRACE_EVENT_VFORK_DONE, pid);
1632 } 1634 }
1635
1636 put_pid(pid);
1633 } else { 1637 } else {
1634 nr = PTR_ERR(p); 1638 nr = PTR_ERR(p);
1635 } 1639 }