fork.c (ff877ea80efa2015b6263766f78ee42c2a1b32f9) fork.c (b69c49b78457f681ecfb3147bd968434ee6559c1)
1/*
2 * linux/kernel/fork.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 */
6
7/*
8 * 'fork.c' contains the help-routines for the 'fork' system call

--- 19 unchanged lines hidden (view full) ---

28#include <linux/binfmts.h>
29#include <linux/mman.h>
30#include <linux/fs.h>
31#include <linux/nsproxy.h>
32#include <linux/capability.h>
33#include <linux/cpu.h>
34#include <linux/cgroup.h>
35#include <linux/security.h>
1/*
2 * linux/kernel/fork.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 */
6
7/*
8 * 'fork.c' contains the help-routines for the 'fork' system call

--- 19 unchanged lines hidden (view full) ---

28#include <linux/binfmts.h>
29#include <linux/mman.h>
30#include <linux/fs.h>
31#include <linux/nsproxy.h>
32#include <linux/capability.h>
33#include <linux/cpu.h>
34#include <linux/cgroup.h>
35#include <linux/security.h>
36#include <linux/hugetlb.h>
36#include <linux/swap.h>
37#include <linux/syscalls.h>
38#include <linux/jiffies.h>
39#include <linux/futex.h>
40#include <linux/task_io_accounting_ops.h>
41#include <linux/rcupdate.h>
42#include <linux/ptrace.h>
43#include <linux/mount.h>

--- 43 unchanged lines hidden (view full) ---

87}
88
89#ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
90# define alloc_task_struct() kmem_cache_alloc(task_struct_cachep, GFP_KERNEL)
91# define free_task_struct(tsk) kmem_cache_free(task_struct_cachep, (tsk))
92static struct kmem_cache *task_struct_cachep;
93#endif
94
37#include <linux/swap.h>
38#include <linux/syscalls.h>
39#include <linux/jiffies.h>
40#include <linux/futex.h>
41#include <linux/task_io_accounting_ops.h>
42#include <linux/rcupdate.h>
43#include <linux/ptrace.h>
44#include <linux/mount.h>

--- 43 unchanged lines hidden (view full) ---

88}
89
90#ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
91# define alloc_task_struct() kmem_cache_alloc(task_struct_cachep, GFP_KERNEL)
92# define free_task_struct(tsk) kmem_cache_free(task_struct_cachep, (tsk))
93static struct kmem_cache *task_struct_cachep;
94#endif
95
96#ifndef __HAVE_ARCH_THREAD_INFO_ALLOCATOR
97static inline struct thread_info *alloc_thread_info(struct task_struct *tsk)
98{
99#ifdef CONFIG_DEBUG_STACK_USAGE
100 gfp_t mask = GFP_KERNEL | __GFP_ZERO;
101#else
102 gfp_t mask = GFP_KERNEL;
103#endif
104 return (struct thread_info *)__get_free_pages(mask, THREAD_SIZE_ORDER);
105}
106
107static inline void free_thread_info(struct thread_info *ti)
108{
109 free_pages((unsigned long)ti, THREAD_SIZE_ORDER);
110}
111#endif
112
95/* SLAB cache for signal_struct structures (tsk->signal) */
96static struct kmem_cache *signal_cachep;
97
98/* SLAB cache for sighand_struct structures (tsk->sighand) */
99struct kmem_cache *sighand_cachep;
100
101/* SLAB cache for files_struct structures (tsk->files) */
102struct kmem_cache *files_cachep;

--- 199 unchanged lines hidden (view full) ---

302 tmp->vm_truncate_count = mpnt->vm_truncate_count;
303 flush_dcache_mmap_lock(file->f_mapping);
304 vma_prio_tree_add(tmp, mpnt);
305 flush_dcache_mmap_unlock(file->f_mapping);
306 spin_unlock(&file->f_mapping->i_mmap_lock);
307 }
308
309 /*
113/* SLAB cache for signal_struct structures (tsk->signal) */
114static struct kmem_cache *signal_cachep;
115
116/* SLAB cache for sighand_struct structures (tsk->sighand) */
117struct kmem_cache *sighand_cachep;
118
119/* SLAB cache for files_struct structures (tsk->files) */
120struct kmem_cache *files_cachep;

--- 199 unchanged lines hidden (view full) ---

320 tmp->vm_truncate_count = mpnt->vm_truncate_count;
321 flush_dcache_mmap_lock(file->f_mapping);
322 vma_prio_tree_add(tmp, mpnt);
323 flush_dcache_mmap_unlock(file->f_mapping);
324 spin_unlock(&file->f_mapping->i_mmap_lock);
325 }
326
327 /*
328 * Clear hugetlb-related page reserves for children. This only
329 * affects MAP_PRIVATE mappings. Faults generated by the child
330 * are not guaranteed to succeed, even if read-only
331 */
332 if (is_vm_hugetlb_page(tmp))
333 reset_vma_resv_huge_pages(tmp);
334
335 /*
310 * Link in the new vma and copy the page table entries.
311 */
312 *pprev = tmp;
313 pprev = &tmp->vm_next;
314
315 __vma_link_rb(mm, tmp, rb_link, rb_parent);
316 rb_link = &tmp->vm_rb.rb_right;
317 rb_parent = &tmp->vm_rb;

--- 1364 unchanged lines hidden ---
336 * Link in the new vma and copy the page table entries.
337 */
338 *pprev = tmp;
339 pprev = &tmp->vm_next;
340
341 __vma_link_rb(mm, tmp, rb_link, rb_parent);
342 rb_link = &tmp->vm_rb.rb_right;
343 rb_parent = &tmp->vm_rb;

--- 1364 unchanged lines hidden ---