[Devel] [PATCH RHEL7 COMMIT] mm/hmm: Restore removed hunk in copy_one_pte(): to merge with: ms/mm: remove rest usage of VM_NONLINEAR and pte_file()

Konstantin Khorenko khorenko at virtuozzo.com
Wed Aug 30 10:51:59 MSK 2017


The commit is pushed to "branch-rh7-3.10.0-693.1.1.vz7.37.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.1.1.el7
------>
commit acd6126a714593569b98eff69671cc094d3227c4
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date:   Wed Aug 30 10:51:59 2017 +0300

    mm/hmm: Restore removed hunk in copy_one_pte(): to merge with: ms/mm: remove rest usage of VM_NONLINEAR and pte_file()
    
    Rebased "ms/mm: remove rest usage of VM_NONLINEAR and pte_file()"
    removed huge hunk from copy_one_pte for no reason. Bring it back
    
    https://jira.sw.ru/browse/PSBM-70740
    
    Fixes: be8e22c9c444 ("ms/mm: remove rest usage of VM_NONLINEAR and pte_file()")
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 mm/memory.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index e53e8dd..c30a042 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -879,13 +879,32 @@ copy_one_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm,
 					pte = pte_swp_mksoft_dirty(pte);
 				set_pte_at(src_mm, addr, src_pte, pte);
 			}
-		} else {
+		} else if (is_hmm_entry(entry)) {
+			page = hmm_entry_to_page(entry);
+
+			/*
+			 * Update rss count even for un-addressable
+			 * page as they should be consider just like
+			 * any other page.
+			 */
+			get_page(page);
+			rss[mm_counter(page)]++;
+			page_dup_rmap(page);
+
+			if (is_write_hmm_entry(entry) &&
+				is_cow_mapping(vm_flags)) {
+				make_hmm_entry_read(&entry);
+				pte = swp_entry_to_pte(entry);
+				if (pte_swp_soft_dirty(*src_pte))
+					pte = pte_swp_mksoft_dirty(pte);
+				set_pte_at(src_mm, addr, src_pte, pte);
+			}
+		} else
 			/*
 			 * This can not happen because HMM migration holds
 			 * mmap_sem in read mode.
 			 */
-			VM_BUG_ON(is_hmm_entry(entry));
-		}
+			 VM_BUG_ON(is_hmm_entry(entry));
 		goto out_set_pte;
 	}
 


More information about the Devel mailing list