]> git.openfabrics.org - ~shefty/rdma-dev.git/blobdiff - mm/huge_memory.c
mm: thp: set the accessed flag for old pages on access fault
[~shefty/rdma-dev.git] / mm / huge_memory.c
index ea5fb93a53a9a0d33f9a2851ee2ab008fe6a8a9e..5f902e20e8c03eb70cd11d569e36a8697ed5d28a 100644 (file)
@@ -784,6 +784,28 @@ out:
        return ret;
 }
 
+void huge_pmd_set_accessed(struct mm_struct *mm,
+                          struct vm_area_struct *vma,
+                          unsigned long address,
+                          pmd_t *pmd, pmd_t orig_pmd,
+                          int dirty)
+{
+       pmd_t entry;
+       unsigned long haddr;
+
+       spin_lock(&mm->page_table_lock);
+       if (unlikely(!pmd_same(*pmd, orig_pmd)))
+               goto unlock;
+
+       entry = pmd_mkyoung(orig_pmd);
+       haddr = address & HPAGE_PMD_MASK;
+       if (pmdp_set_access_flags(vma, haddr, pmd, entry, dirty))
+               update_mmu_cache_pmd(vma, address, pmd);
+
+unlock:
+       spin_unlock(&mm->page_table_lock);
+}
+
 static int do_huge_pmd_wp_page_fallback(struct mm_struct *mm,
                                        struct vm_area_struct *vma,
                                        unsigned long address,