Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1616937

[PATCH v2 6/9] mm: rmap: Use correct helper when poisoning hugepages

From Punit Agrawal <punit.agrawal@arm.com>
Newsgroups linux.kernel
Subject [PATCH v2 6/9] mm: rmap: Use correct helper when poisoning hugepages
Date 2017-04-05 15:50 +0200
Message-ID <tsTtU-3hW-33@gated-at.bofh.it> (permalink)
References <tsTtT-3hW-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Using set_pte_at() does not do the right thing when putting down
HWPOISON swap entries for hugepages on architectures that support
contiguous ptes.

Fix this problem by using set_huge_swap_pte_at() which was introduced to
fix exactly this problem.

Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
---
 mm/rmap.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/mm/rmap.c b/mm/rmap.c
index f6838015810f..e07c7912a166 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1386,15 +1386,19 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
 		update_hiwater_rss(mm);
 
 		if (PageHWPoison(page) && !(flags & TTU_IGNORE_HWPOISON)) {
+			pteval = swp_entry_to_pte(make_hwpoison_entry(subpage));
 			if (PageHuge(page)) {
 				int nr = 1 << compound_order(page);
 				hugetlb_count_sub(nr, mm);
+				set_huge_swap_pte_at(mm, address,
+						     pvmw.pte, pteval,
+						     vma_mmu_pagesize(vma));
 			} else {
 				dec_mm_counter(mm, mm_counter(page));
+				set_pte_at(mm, address, pvmw.pte, pteval);
 			}
 
-			pteval = swp_entry_to_pte(make_hwpoison_entry(subpage));
-			set_pte_at(mm, address, pvmw.pte, pteval);
+
 		} else if (pte_unused(pteval)) {
 			/*
 			 * The guest indicated that the page content is of no
-- 
2.11.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH v2 6/9] mm: rmap: Use correct helper when poisoning hugepages Punit Agrawal <punit.agrawal@arm.com> - 2017-04-05 15:50 +0200
  Re: [PATCH v2 6/9] mm: rmap: Use correct helper when poisoning  hugepages kbuild test robot <lkp@intel.com> - 2017-04-06 03:30 +0200

csiph-web