diff options
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index fd22245e3881..7f2e31ba33af 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -82,26 +82,26 @@ int nr_processes(void) | |||
82 | #ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR | 82 | #ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR |
83 | # define alloc_task_struct() kmem_cache_alloc(task_struct_cachep, GFP_KERNEL) | 83 | # define alloc_task_struct() kmem_cache_alloc(task_struct_cachep, GFP_KERNEL) |
84 | # define free_task_struct(tsk) kmem_cache_free(task_struct_cachep, (tsk)) | 84 | # define free_task_struct(tsk) kmem_cache_free(task_struct_cachep, (tsk)) |
85 | static kmem_cache_t *task_struct_cachep; | 85 | static struct kmem_cache *task_struct_cachep; |
86 | #endif | 86 | #endif |
87 | 87 | ||
88 | /* SLAB cache for signal_struct structures (tsk->signal) */ | 88 | /* SLAB cache for signal_struct structures (tsk->signal) */ |
89 | static kmem_cache_t *signal_cachep; | 89 | static struct kmem_cache *signal_cachep; |
90 | 90 | ||
91 | /* SLAB cache for sighand_struct structures (tsk->sighand) */ | 91 | /* SLAB cache for sighand_struct structures (tsk->sighand) */ |
92 | kmem_cache_t *sighand_cachep; | 92 | struct kmem_cache *sighand_cachep; |
93 | 93 | ||
94 | /* SLAB cache for files_struct structures (tsk->files) */ | 94 | /* SLAB cache for files_struct structures (tsk->files) */ |
95 | kmem_cache_t *files_cachep; | 95 | struct kmem_cache *files_cachep; |
96 | 96 | ||
97 | /* SLAB cache for fs_struct structures (tsk->fs) */ | 97 | /* SLAB cache for fs_struct structures (tsk->fs) */ |
98 | kmem_cache_t *fs_cachep; | 98 | struct kmem_cache *fs_cachep; |
99 | 99 | ||
100 | /* SLAB cache for vm_area_struct structures */ | 100 | /* SLAB cache for vm_area_struct structures */ |
101 | kmem_cache_t *vm_area_cachep; | 101 | struct kmem_cache *vm_area_cachep; |
102 | 102 | ||
103 | /* SLAB cache for mm_struct structures (tsk->mm) */ | 103 | /* SLAB cache for mm_struct structures (tsk->mm) */ |
104 | static kmem_cache_t *mm_cachep; | 104 | static struct kmem_cache *mm_cachep; |
105 | 105 | ||
106 | void free_task(struct task_struct *tsk) | 106 | void free_task(struct task_struct *tsk) |
107 | { | 107 | { |
@@ -237,7 +237,7 @@ static inline int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm) | |||
237 | goto fail_nomem; | 237 | goto fail_nomem; |
238 | charge = len; | 238 | charge = len; |
239 | } | 239 | } |
240 | tmp = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); | 240 | tmp = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL); |
241 | if (!tmp) | 241 | if (!tmp) |
242 | goto fail_nomem; | 242 | goto fail_nomem; |
243 | *tmp = *mpnt; | 243 | *tmp = *mpnt; |
@@ -319,7 +319,7 @@ static inline void mm_free_pgd(struct mm_struct * mm) | |||
319 | 319 | ||
320 | __cacheline_aligned_in_smp DEFINE_SPINLOCK(mmlist_lock); | 320 | __cacheline_aligned_in_smp DEFINE_SPINLOCK(mmlist_lock); |
321 | 321 | ||
322 | #define allocate_mm() (kmem_cache_alloc(mm_cachep, SLAB_KERNEL)) | 322 | #define allocate_mm() (kmem_cache_alloc(mm_cachep, GFP_KERNEL)) |
323 | #define free_mm(mm) (kmem_cache_free(mm_cachep, (mm))) | 323 | #define free_mm(mm) (kmem_cache_free(mm_cachep, (mm))) |
324 | 324 | ||
325 | #include <linux/init_task.h> | 325 | #include <linux/init_task.h> |
@@ -448,7 +448,16 @@ void mm_release(struct task_struct *tsk, struct mm_struct *mm) | |||
448 | tsk->vfork_done = NULL; | 448 | tsk->vfork_done = NULL; |
449 | complete(vfork_done); | 449 | complete(vfork_done); |
450 | } | 450 | } |
451 | if (tsk->clear_child_tid && atomic_read(&mm->mm_users) > 1) { | 451 | |
452 | /* | ||
453 | * If we're exiting normally, clear a user-space tid field if | ||
454 | * requested. We leave this alone when dying by signal, to leave | ||
455 | * the value intact in a core dump, and to save the unnecessary | ||
456 | * trouble otherwise. Userland only wants this done for a sys_exit. | ||
457 | */ | ||
458 | if (tsk->clear_child_tid | ||
459 | && !(tsk->flags & PF_SIGNALED) | ||
460 | && atomic_read(&mm->mm_users) > 1) { | ||
452 | u32 __user * tidptr = tsk->clear_child_tid; | 461 | u32 __user * tidptr = tsk->clear_child_tid; |
453 | tsk->clear_child_tid = NULL; | 462 | tsk->clear_child_tid = NULL; |
454 | 463 | ||
@@ -479,6 +488,10 @@ static struct mm_struct *dup_mm(struct task_struct *tsk) | |||
479 | 488 | ||
480 | memcpy(mm, oldmm, sizeof(*mm)); | 489 | memcpy(mm, oldmm, sizeof(*mm)); |
481 | 490 | ||
491 | /* Initializing for Swap token stuff */ | ||
492 | mm->token_priority = 0; | ||
493 | mm->last_interval = 0; | ||
494 | |||
482 | if (!mm_init(mm)) | 495 | if (!mm_init(mm)) |
483 | goto fail_nomem; | 496 | goto fail_nomem; |
484 | 497 | ||
@@ -542,6 +555,10 @@ static int copy_mm(unsigned long clone_flags, struct task_struct * tsk) | |||
542 | goto fail_nomem; | 555 | goto fail_nomem; |
543 | 556 | ||
544 | good_mm: | 557 | good_mm: |
558 | /* Initializing for Swap token stuff */ | ||
559 | mm->token_priority = 0; | ||
560 | mm->last_interval = 0; | ||
561 | |||
545 | tsk->mm = mm; | 562 | tsk->mm = mm; |
546 | tsk->active_mm = mm; | 563 | tsk->active_mm = mm; |
547 | return 0; | 564 | return 0; |
@@ -613,7 +630,7 @@ static struct files_struct *alloc_files(void) | |||
613 | struct files_struct *newf; | 630 | struct files_struct *newf; |
614 | struct fdtable *fdt; | 631 | struct fdtable *fdt; |
615 | 632 | ||
616 | newf = kmem_cache_alloc(files_cachep, SLAB_KERNEL); | 633 | newf = kmem_cache_alloc(files_cachep, GFP_KERNEL); |
617 | if (!newf) | 634 | if (!newf) |
618 | goto out; | 635 | goto out; |
619 | 636 | ||
@@ -830,7 +847,6 @@ static inline int copy_signal(unsigned long clone_flags, struct task_struct * ts | |||
830 | if (clone_flags & CLONE_THREAD) { | 847 | if (clone_flags & CLONE_THREAD) { |
831 | atomic_inc(¤t->signal->count); | 848 | atomic_inc(¤t->signal->count); |
832 | atomic_inc(¤t->signal->live); | 849 | atomic_inc(¤t->signal->live); |
833 | taskstats_tgid_alloc(current); | ||
834 | return 0; | 850 | return 0; |
835 | } | 851 | } |
836 | sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL); | 852 | sig = kmem_cache_alloc(signal_cachep, GFP_KERNEL); |
@@ -1413,7 +1429,7 @@ long do_fork(unsigned long clone_flags, | |||
1413 | #define ARCH_MIN_MMSTRUCT_ALIGN 0 | 1429 | #define ARCH_MIN_MMSTRUCT_ALIGN 0 |
1414 | #endif | 1430 | #endif |
1415 | 1431 | ||
1416 | static void sighand_ctor(void *data, kmem_cache_t *cachep, unsigned long flags) | 1432 | static void sighand_ctor(void *data, struct kmem_cache *cachep, unsigned long flags) |
1417 | { | 1433 | { |
1418 | struct sighand_struct *sighand = data; | 1434 | struct sighand_struct *sighand = data; |
1419 | 1435 | ||