aboutsummaryrefslogtreecommitdiffstats
path: root/mm/mmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/mmap.c')
-rw-r--r--mm/mmap.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index 376492ed08f4..e02f1aa66a1a 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -27,6 +27,7 @@
27#include <linux/mount.h> 27#include <linux/mount.h>
28#include <linux/mempolicy.h> 28#include <linux/mempolicy.h>
29#include <linux/rmap.h> 29#include <linux/rmap.h>
30#include <linux/ksm.h>
30#include <linux/mmu_notifier.h> 31#include <linux/mmu_notifier.h>
31#include <linux/perf_event.h> 32#include <linux/perf_event.h>
32 33
@@ -2111,6 +2112,14 @@ void exit_mmap(struct mm_struct *mm)
2111 /* Use -1 here to ensure all VMAs in the mm are unmapped */ 2112 /* Use -1 here to ensure all VMAs in the mm are unmapped */
2112 end = unmap_vmas(&tlb, vma, 0, -1, &nr_accounted, NULL); 2113 end = unmap_vmas(&tlb, vma, 0, -1, &nr_accounted, NULL);
2113 vm_unacct_memory(nr_accounted); 2114 vm_unacct_memory(nr_accounted);
2115
2116 /*
2117 * For KSM to handle OOM without deadlock when it's breaking COW in a
2118 * likely victim of the OOM killer, we must serialize with ksm_exit()
2119 * after freeing mm's pages but before freeing its page tables.
2120 */
2121 ksm_exit(mm, &tlb, end);
2122
2114 free_pgtables(tlb, vma, FIRST_USER_ADDRESS, 0); 2123 free_pgtables(tlb, vma, FIRST_USER_ADDRESS, 0);
2115 tlb_finish_mmu(tlb, 0, end); 2124 tlb_finish_mmu(tlb, 0, end);
2116 2125