aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-09 03:23:15 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-09 03:23:15 -0400
commit9e2d8656f5e8aa214e66b462680cf86b210b74a8 (patch)
treef67d62e896cedf75599ea45f9ecf9999c6ad24cd /kernel/fork.c
parent1ea4f4f8405cc1ceec23f2d261bc3775785e6712 (diff)
parent9e695d2ecc8451cc2c1603d60b5c8e7f5581923a (diff)
Merge branch 'akpm' (Andrew's patch-bomb)
Merge patches from Andrew Morton: "A few misc things and very nearly all of the MM tree. A tremendous amount of stuff (again), including a significant rbtree library rework." * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (160 commits) sparc64: Support transparent huge pages. mm: thp: Use more portable PMD clearing sequenece in zap_huge_pmd(). mm: Add and use update_mmu_cache_pmd() in transparent huge page code. sparc64: Document PGD and PMD layout. sparc64: Eliminate PTE table memory wastage. sparc64: Halve the size of PTE tables sparc64: Only support 4MB huge pages and 8KB base pages. memory-hotplug: suppress "Trying to free nonexistent resource <XXXXXXXXXXXXXXXX-YYYYYYYYYYYYYYYY>" warning mm: memcg: clean up mm_match_cgroup() signature mm: document PageHuge somewhat mm: use %pK for /proc/vmallocinfo mm, thp: fix mlock statistics mm, thp: fix mapped pages avoiding unevictable list on mlock memory-hotplug: update memory block's state and notify userspace memory-hotplug: preparation to notify memory block's state at memory hot remove mm: avoid section mismatch warning for memblock_type_name make GFP_NOTRACK definition unconditional cma: decrease cc.nr_migratepages after reclaiming pagelist CMA: migrate mlocked pages kpageflags: fix wrong KPF_THP on non-huge compound pages ...
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c32
1 files changed, 7 insertions, 25 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index a2b1efc20928..1cd7d581b3b2 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -423,7 +423,12 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
423 mapping->i_mmap_writable++; 423 mapping->i_mmap_writable++;
424 flush_dcache_mmap_lock(mapping); 424 flush_dcache_mmap_lock(mapping);
425 /* insert tmp into the share list, just after mpnt */ 425 /* insert tmp into the share list, just after mpnt */
426 vma_prio_tree_add(tmp, mpnt); 426 if (unlikely(tmp->vm_flags & VM_NONLINEAR))
427 vma_nonlinear_insert(tmp,
428 &mapping->i_mmap_nonlinear);
429 else
430 vma_interval_tree_insert_after(tmp, mpnt,
431 &mapping->i_mmap);
427 flush_dcache_mmap_unlock(mapping); 432 flush_dcache_mmap_unlock(mapping);
428 mutex_unlock(&mapping->i_mmap_mutex); 433 mutex_unlock(&mapping->i_mmap_mutex);
429 } 434 }
@@ -622,26 +627,6 @@ void mmput(struct mm_struct *mm)
622} 627}
623EXPORT_SYMBOL_GPL(mmput); 628EXPORT_SYMBOL_GPL(mmput);
624 629
625/*
626 * We added or removed a vma mapping the executable. The vmas are only mapped
627 * during exec and are not mapped with the mmap system call.
628 * Callers must hold down_write() on the mm's mmap_sem for these
629 */
630void added_exe_file_vma(struct mm_struct *mm)
631{
632 mm->num_exe_file_vmas++;
633}
634
635void removed_exe_file_vma(struct mm_struct *mm)
636{
637 mm->num_exe_file_vmas--;
638 if ((mm->num_exe_file_vmas == 0) && mm->exe_file) {
639 fput(mm->exe_file);
640 mm->exe_file = NULL;
641 }
642
643}
644
645void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file) 630void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file)
646{ 631{
647 if (new_exe_file) 632 if (new_exe_file)
@@ -649,15 +634,13 @@ void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file)
649 if (mm->exe_file) 634 if (mm->exe_file)
650 fput(mm->exe_file); 635 fput(mm->exe_file);
651 mm->exe_file = new_exe_file; 636 mm->exe_file = new_exe_file;
652 mm->num_exe_file_vmas = 0;
653} 637}
654 638
655struct file *get_mm_exe_file(struct mm_struct *mm) 639struct file *get_mm_exe_file(struct mm_struct *mm)
656{ 640{
657 struct file *exe_file; 641 struct file *exe_file;
658 642
659 /* We need mmap_sem to protect against races with removal of 643 /* We need mmap_sem to protect against races with removal of exe_file */
660 * VM_EXECUTABLE vmas */
661 down_read(&mm->mmap_sem); 644 down_read(&mm->mmap_sem);
662 exe_file = mm->exe_file; 645 exe_file = mm->exe_file;
663 if (exe_file) 646 if (exe_file)
@@ -1078,7 +1061,6 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
1078 init_rwsem(&sig->group_rwsem); 1061 init_rwsem(&sig->group_rwsem);
1079#endif 1062#endif
1080 1063
1081 sig->oom_adj = current->signal->oom_adj;
1082 sig->oom_score_adj = current->signal->oom_score_adj; 1064 sig->oom_score_adj = current->signal->oom_score_adj;
1083 sig->oom_score_adj_min = current->signal->oom_score_adj_min; 1065 sig->oom_score_adj_min = current->signal->oom_score_adj_min;
1084 1066