From patchwork Wed May 22 16:57:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [-V9, 02/20] mm/THP: Use the right function when updating access flags X-Patchwork-Submitter: Aneesh Kumar K V X-Patchwork-Id: 245668 X-Patchwork-Delegate: benh@kernel.crashing.org Message-Id: <1369241872-15700-3-git-send-email-aneesh.kumar@linux.vnet.ibm.com> To: benh@kernel.crashing.org, paulus@samba.org, dwg@au1.ibm.com Cc: linuxppc-dev@lists.ozlabs.org, "Aneesh Kumar K.V" Date: Wed, 22 May 2013 22:27:34 +0530 From: "Aneesh Kumar K.V" List-Id: Linux on PowerPC Developers Mail List From: "Aneesh Kumar K.V" We should use pmdp_set_access_flags to update access flags. Archs like powerpc use extra checks(_PAGE_BUSY) when updating a hugepage PTE. A set_pmd_at doesn't do those checks. We should use set_pmd_at only when updating a none hugepage PTE. Signed-off-by: Aneesh Kumar K.V --- mm/huge_memory.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 362c329..dab90fd 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1265,7 +1265,9 @@ struct page *follow_trans_huge_pmd(struct vm_area_struct *vma, * young bit, instead of the current set_pmd_at. */ _pmd = pmd_mkyoung(pmd_mkdirty(*pmd)); - set_pmd_at(mm, addr & HPAGE_PMD_MASK, pmd, _pmd); + if (pmdp_set_access_flags(vma, addr & HPAGE_PMD_MASK, + pmd, _pmd, 1)) + update_mmu_cache_pmd(vma, addr, pmd); } if ((flags & FOLL_MLOCK) && (vma->vm_flags & VM_LOCKED)) { if (page->mapping && trylock_page(page)) {