The patch titled Subject: mm: /proc/pid/clear_refs: avoid split_huge_page() has been removed from the -mm tree. Its filename was mm-prom-pid-clear_refs-avoid-split_huge_page.patch This patch was dropped because it was nacked ------------------------------------------------------ From: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx> Subject: mm: /proc/pid/clear_refs: avoid split_huge_page() Currently pagewalker splits all THP pages on any clear_refs request. It's not necessary. We can handle this on PMD level. One side effect is that soft dirty will potentially see more dirty memory, since we will mark whole THP page dirty at once. Sanity checked with CRIU test suite. More testing is required. Signed-off-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: Pavel Emelyanov <xemul@xxxxxxxxxxxxx> Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx> Cc: Dave Hansen <dave.hansen@xxxxxxxxx> Cc: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx> Cc: Cyrill Gorcunov <gorcunov@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/proc/task_mmu.c | 58 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-) diff -puN fs/proc/task_mmu.c~mm-prom-pid-clear_refs-avoid-split_huge_page fs/proc/task_mmu.c --- a/fs/proc/task_mmu.c~mm-prom-pid-clear_refs-avoid-split_huge_page +++ a/fs/proc/task_mmu.c @@ -708,10 +708,10 @@ struct clear_refs_private { enum clear_refs_types type; }; +#ifdef CONFIG_MEM_SOFT_DIRTY static inline void clear_soft_dirty(struct vm_area_struct *vma, unsigned long addr, pte_t *pte) { -#ifdef CONFIG_MEM_SOFT_DIRTY /* * The soft-dirty tracker uses #PF-s to catch writes * to pages, so write-protect the pte as well. See the @@ -730,9 +730,35 @@ static inline void clear_soft_dirty(stru } set_pte_at(vma->vm_mm, addr, pte, ptent); -#endif } +static inline void clear_soft_dirty_pmd(struct vm_area_struct *vma, + unsigned long addr, pmd_t *pmdp) +{ + pmd_t pmd = *pmdp; + + pmd = pmd_wrprotect(pmd); + pmd = pmd_clear_flags(pmd, _PAGE_SOFT_DIRTY); + + if (vma->vm_flags & VM_SOFTDIRTY) + vma->vm_flags &= ~VM_SOFTDIRTY; + + set_pmd_at(vma->vm_mm, addr, pmdp, pmd); +} + +#else + +static inline void clear_soft_dirty(struct vm_area_struct *vma, + unsigned long addr, pte_t *pte) +{ +} + +static inline void clear_soft_dirty_pmd(struct vm_area_struct *vma, + unsigned long addr, pmd_t *pmdp) +{ +} +#endif + static int clear_refs_pte(pte_t *pte, unsigned long addr, unsigned long end, struct mm_walk *walk) { @@ -755,6 +781,33 @@ static int clear_refs_pte(pte_t *pte, un return 0; } +static int clear_refs_pmd(pmd_t *pmd, unsigned long addr, + unsigned long end, struct mm_walk *walk) +{ + struct clear_refs_private *cp = walk->private; + struct vm_area_struct *vma = walk->vma; + struct page *page; + spinlock_t *ptl; + + if (pmd_trans_huge_lock(pmd, vma, &ptl) != 1) + return 0; + if (cp->type == CLEAR_REFS_SOFT_DIRTY) { + clear_soft_dirty_pmd(vma, addr, pmd); + goto out; + } + + page = pmd_page(*pmd); + + /* Clear accessed and referenced bits. */ + pmdp_test_and_clear_young(vma, addr, pmd); + ClearPageReferenced(page); +out: + spin_unlock(ptl); + /* handled as pmd, no need to call clear_refs_pte() */ + walk->skip = 1; + return 0; +} + static int clear_refs_test_walk(unsigned long start, unsigned long end, struct mm_walk *walk) { @@ -818,6 +871,7 @@ static ssize_t clear_refs_write(struct f }; struct mm_walk clear_refs_walk = { .pte_entry = clear_refs_pte, + .pmd_entry = clear_refs_pmd, .test_walk = clear_refs_test_walk, .mm = mm, .private = &cp, _ Patches currently in -mm which might be from kirill.shutemov@xxxxxxxxxxxxxxx are mm-memoryc-use-entry-=-access_oncepte-in-handle_pte_fault.patch mm-introduce-do_shared_fault-and-drop-do_fault-fix-fix.patch do_shared_fault-check-that-mmap_sem-is-held.patch mm-replace-remap_file_pages-syscall-with-emulation.patch mm-replace-remap_file_pages-syscall-with-emulation-fix.patch mm-replace-remap_file_pages-syscall-with-emulation-fix-2.patch mm-replace-remap_file_pages-syscall-with-emulation-fix-3.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html