--- v4
+++ v2
@@ -38,10 +38,10 @@
3 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/include/linux/rmap.h b/include/linux/rmap.h
-index 733d3d8181e2..d91be69c1c60 100644
+index 43ef2c30cb0f..f5cd4dbc78b0 100644
--- a/include/linux/rmap.h
+++ b/include/linux/rmap.h
-@@ -173,8 +173,16 @@ void page_add_anon_rmap(struct page *, struct vm_area_struct *,
+@@ -170,8 +170,16 @@ void page_add_anon_rmap(struct page *, struct vm_area_struct *,
unsigned long, bool);
void do_page_add_anon_rmap(struct page *, struct vm_area_struct *,
unsigned long, int);
@@ -61,10 +61,10 @@
void page_remove_rmap(struct page *, bool);
diff --git a/mm/memory.c b/mm/memory.c
-index 3ea1bbe6cb03..7cbf03f1a7ca 100644
+index 9f9e5bb7a556..51bc8315281e 100644
--- a/mm/memory.c
+++ b/mm/memory.c
-@@ -2551,7 +2551,7 @@ static int wp_page_copy(struct vm_fault *vmf)
+@@ -2376,7 +2376,7 @@ static int wp_page_copy(struct vm_fault *vmf)
* thread doing COW.
*/
ptep_clear_flush_notify(vma, vmf->address, vmf->pte);
@@ -73,16 +73,16 @@
mem_cgroup_commit_charge(new_page, memcg, false, false);
__lru_cache_add_active_or_unevictable(new_page, vmf->vma_flags);
/*
-@@ -3065,7 +3065,7 @@ int do_swap_page(struct vm_fault *vmf)
-
- /* ksm created a completely new copy */
- if (unlikely(page != swapcache && swapcache)) {
+@@ -2847,7 +2847,7 @@ int do_swap_page(struct vm_fault *vmf)
+ mem_cgroup_commit_charge(page, memcg, true, false);
+ activate_page(page);
+ } else { /* ksm created a completely new copy */
- page_add_new_anon_rmap(page, vma, vmf->address, false);
+ __page_add_new_anon_rmap(page, vma, vmf->address, false);
mem_cgroup_commit_charge(page, memcg, false, false);
__lru_cache_add_active_or_unevictable(page, vmf->vma_flags);
- } else {
-@@ -3215,7 +3215,7 @@ static int do_anonymous_page(struct vm_fault *vmf)
+ }
+@@ -2985,7 +2985,7 @@ static int do_anonymous_page(struct vm_fault *vmf)
}
inc_mm_counter_fast(vma->vm_mm, MM_ANONPAGES);
@@ -91,7 +91,7 @@
mem_cgroup_commit_charge(page, memcg, false, false);
__lru_cache_add_active_or_unevictable(page, vmf->vma_flags);
setpte:
-@@ -3467,7 +3467,7 @@ int alloc_set_pte(struct vm_fault *vmf, struct mem_cgroup *memcg,
+@@ -3237,7 +3237,7 @@ int alloc_set_pte(struct vm_fault *vmf, struct mem_cgroup *memcg,
/* copy-on-write page */
if (write && !(vmf->vma_flags & VM_SHARED)) {
inc_mm_counter_fast(vma->vm_mm, MM_ANONPAGES);
@@ -101,10 +101,10 @@
__lru_cache_add_active_or_unevictable(page, vmf->vma_flags);
} else {
diff --git a/mm/rmap.c b/mm/rmap.c
-index 787c07fb37dc..357ea765e795 100644
+index c1286d47aa1f..0c9f8ded669a 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
-@@ -1138,7 +1138,7 @@ void do_page_add_anon_rmap(struct page *page,
+@@ -1122,7 +1122,7 @@ void do_page_add_anon_rmap(struct page *page,
}
/**
@@ -113,7 +113,7 @@
* @page: the page to add the mapping to
* @vma: the vm area in which the mapping is added
* @address: the user virtual address mapped
-@@ -1148,12 +1148,11 @@ void do_page_add_anon_rmap(struct page *page,
+@@ -1132,12 +1132,11 @@ void do_page_add_anon_rmap(struct page *page,
* This means the inc-and-test can be bypassed.
* Page does not have to be locked.
*/