diff for duplicates of <87tw07uz7p.fsf@linux.vnet.ibm.com> diff --git a/a/1.txt b/N1/1.txt index 1905329..17d89f6 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -1,255 +1,2 @@ How about this additional patch ?. This results in code reduction. - -From fed62d0541ae78206a1a25caeb46a3ffa7ade9c8 Mon Sep 17 00:00:00 2001 -From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> -Date: Thu, 27 Jul 2017 12:21:33 +0530 -Subject: [PATCH] mm/thp: Remove pmd_huge_split_prepare - -Instead of marking the pmd ready for split, invalidate the pmd. This should -take care of powerpc requirement. Only side effect is that we mark the pmd -invalid early. This can result in us blocking access to the page a bit longer -if we race against a thp split. - -Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> ---- - arch/powerpc/include/asm/book3s/64/hash-4k.h | 2 - - arch/powerpc/include/asm/book3s/64/hash-64k.h | 2 - - arch/powerpc/include/asm/book3s/64/pgtable.h | 9 ---- - arch/powerpc/include/asm/book3s/64/radix.h | 6 --- - arch/powerpc/mm/pgtable-hash64.c | 22 -------- - include/asm-generic/pgtable.h | 8 --- - mm/huge_memory.c | 73 +++++++++++++-------------- - 7 files changed, 35 insertions(+), 87 deletions(-) - -diff --git a/arch/powerpc/include/asm/book3s/64/hash-4k.h b/arch/powerpc/include/asm/book3s/64/hash-4k.h -index d65dcb5826ff..2416edb74d28 100644 ---- a/arch/powerpc/include/asm/book3s/64/hash-4k.h -+++ b/arch/powerpc/include/asm/book3s/64/hash-4k.h -@@ -112,8 +112,6 @@ extern pmd_t hash__pmdp_collapse_flush(struct vm_area_struct *vma, - extern void hash__pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp, - pgtable_t pgtable); - extern pgtable_t hash__pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp); --extern void hash__pmdp_huge_split_prepare(struct vm_area_struct *vma, -- unsigned long address, pmd_t *pmdp); - extern pmd_t hash__pmdp_huge_get_and_clear(struct mm_struct *mm, - unsigned long addr, pmd_t *pmdp); - extern int hash__has_transparent_hugepage(void); -diff --git a/arch/powerpc/include/asm/book3s/64/hash-64k.h b/arch/powerpc/include/asm/book3s/64/hash-64k.h -index ab36323b8a3e..001202cabedf 100644 ---- a/arch/powerpc/include/asm/book3s/64/hash-64k.h -+++ b/arch/powerpc/include/asm/book3s/64/hash-64k.h -@@ -162,8 +162,6 @@ extern pmd_t hash__pmdp_collapse_flush(struct vm_area_struct *vma, - extern void hash__pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp, - pgtable_t pgtable); - extern pgtable_t hash__pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp); --extern void hash__pmdp_huge_split_prepare(struct vm_area_struct *vma, -- unsigned long address, pmd_t *pmdp); - extern pmd_t hash__pmdp_huge_get_and_clear(struct mm_struct *mm, - unsigned long addr, pmd_t *pmdp); - extern int hash__has_transparent_hugepage(void); -diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h -index 6cf53dc70efc..fee01ffe3b60 100644 ---- a/arch/powerpc/include/asm/book3s/64/pgtable.h -+++ b/arch/powerpc/include/asm/book3s/64/pgtable.h -@@ -1114,15 +1114,6 @@ static inline pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm, - extern pmd_t pmdp_invalidate(struct vm_area_struct *vma, unsigned long address, - pmd_t *pmdp); - --#define __HAVE_ARCH_PMDP_HUGE_SPLIT_PREPARE --static inline void pmdp_huge_split_prepare(struct vm_area_struct *vma, -- unsigned long address, pmd_t *pmdp) --{ -- if (radix_enabled()) -- return radix__pmdp_huge_split_prepare(vma, address, pmdp); -- return hash__pmdp_huge_split_prepare(vma, address, pmdp); --} -- - #define pmd_move_must_withdraw pmd_move_must_withdraw - struct spinlock; - static inline int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl, -diff --git a/arch/powerpc/include/asm/book3s/64/radix.h b/arch/powerpc/include/asm/book3s/64/radix.h -index f5ece365d929..389be8b6c9f7 100644 ---- a/arch/powerpc/include/asm/book3s/64/radix.h -+++ b/arch/powerpc/include/asm/book3s/64/radix.h -@@ -272,12 +272,6 @@ static inline pmd_t radix__pmd_mkhuge(pmd_t pmd) - return __pmd(pmd_val(pmd) | _PAGE_PTE | R_PAGE_LARGE); - return __pmd(pmd_val(pmd) | _PAGE_PTE); - } --static inline void radix__pmdp_huge_split_prepare(struct vm_area_struct *vma, -- unsigned long address, pmd_t *pmdp) --{ -- /* Nothing to do for radix. */ -- return; --} - - extern unsigned long radix__pmd_hugepage_update(struct mm_struct *mm, unsigned long addr, - pmd_t *pmdp, unsigned long clr, -diff --git a/arch/powerpc/mm/pgtable-hash64.c b/arch/powerpc/mm/pgtable-hash64.c -index ec277913e01b..469808e77e58 100644 ---- a/arch/powerpc/mm/pgtable-hash64.c -+++ b/arch/powerpc/mm/pgtable-hash64.c -@@ -296,28 +296,6 @@ pgtable_t hash__pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp) - return pgtable; - } - --void hash__pmdp_huge_split_prepare(struct vm_area_struct *vma, -- unsigned long address, pmd_t *pmdp) --{ -- VM_BUG_ON(address & ~HPAGE_PMD_MASK); -- VM_BUG_ON(REGION_ID(address) != USER_REGION_ID); -- VM_BUG_ON(pmd_devmap(*pmdp)); -- -- /* -- * We can't mark the pmd none here, because that will cause a race -- * against exit_mmap. We need to continue mark pmd TRANS HUGE, while -- * we spilt, but at the same time we wan't rest of the ppc64 code -- * not to insert hash pte on this, because we will be modifying -- * the deposited pgtable in the caller of this function. Hence -- * clear the _PAGE_USER so that we move the fault handling to -- * higher level function and that will serialize against ptl. -- * We need to flush existing hash pte entries here even though, -- * the translation is still valid, because we will withdraw -- * pgtable_t after this. -- */ -- pmd_hugepage_update(vma->vm_mm, address, pmdp, 0, _PAGE_PRIVILEGED); --} -- - /* - * A linux hugepage PMD was changed and the corresponding hash table entries - * neesd to be flushed. -diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h -index ece5e399567a..b934e41277ac 100644 ---- a/include/asm-generic/pgtable.h -+++ b/include/asm-generic/pgtable.h -@@ -313,14 +313,6 @@ extern pmd_t pmdp_invalidate(struct vm_area_struct *vma, unsigned long address, - pmd_t *pmdp); - #endif - --#ifndef __HAVE_ARCH_PMDP_HUGE_SPLIT_PREPARE --static inline void pmdp_huge_split_prepare(struct vm_area_struct *vma, -- unsigned long address, pmd_t *pmdp) --{ -- --} --#endif -- - #ifndef __HAVE_ARCH_PTE_SAME - static inline int pte_same(pte_t pte_a, pte_t pte_b) - { -diff --git a/mm/huge_memory.c b/mm/huge_memory.c -index d72c2d20e9c6..59ec8c916368 100644 ---- a/mm/huge_memory.c -+++ b/mm/huge_memory.c -@@ -1944,8 +1944,8 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd, - struct mm_struct *mm = vma->vm_mm; - struct page *page; - pgtable_t pgtable; -- pmd_t old, _pmd; -- bool young, write, soft_dirty; -+ pmd_t old_pmd, _pmd; -+ bool young, write, dirty, soft_dirty; - unsigned long addr; - int i; - -@@ -1977,14 +1977,39 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd, - return __split_huge_zero_page_pmd(vma, haddr, pmd); - } - -- page = pmd_page(*pmd); -+ /* -+ * Up to this point the pmd is present and huge and userland has the -+ * whole access to the hugepage during the split (which happens in -+ * place). If we overwrite the pmd with the not-huge version pointing -+ * to the pte here (which of course we could if all CPUs were bug -+ * free), userland could trigger a small page size TLB miss on the -+ * small sized TLB while the hugepage TLB entry is still established in -+ * the huge TLB. Some CPU doesn't like that. -+ * See http://support.amd.com/us/Processor_TechDocs/41322.pdf, Erratum -+ * 383 on page 93. Intel should be safe but is also warns that it's -+ * only safe if the permission and cache attributes of the two entries -+ * loaded in the two TLB is identical (which should be the case here). -+ * But it is generally safer to never allow small and huge TLB entries -+ * for the same virtual address to be loaded simultaneously. So instead -+ * of doing "pmd_populate(); flush_pmd_tlb_range();" we first mark the -+ * current pmd notpresent (atomically because here the pmd_trans_huge -+ * and pmd_trans_splitting must remain set at all times on the pmd -+ * until the split is complete for this pmd), then we flush the SMP TLB -+ * and finally we write the non-huge version of the pmd entry with -+ * pmd_populate. -+ */ -+ old_pmd = pmdp_invalidate(vma, haddr, pmd); -+ -+ page = pmd_page(old_pmd); - VM_BUG_ON_PAGE(!page_count(page), page); - page_ref_add(page, HPAGE_PMD_NR - 1); -- write = pmd_write(*pmd); -- young = pmd_young(*pmd); -- soft_dirty = pmd_soft_dirty(*pmd); -- -- pmdp_huge_split_prepare(vma, haddr, pmd); -+ write = pmd_write(old_pmd); -+ young = pmd_young(old_pmd); -+ dirty = pmd_dirty(old_pmd); -+ soft_dirty = pmd_soft_dirty(old_pmd); -+ /* -+ * withdraw the table only after we mark the pmd entry invalid -+ */ - pgtable = pgtable_trans_huge_withdraw(mm, pmd); - pmd_populate(mm, &_pmd, pgtable); - -@@ -2011,6 +2036,8 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd, - if (soft_dirty) - entry = pte_mksoft_dirty(entry); - } -+ if (dirty) -+ SetPageDirty(page + i); - pte = pte_offset_map(&_pmd, addr); - BUG_ON(!pte_none(*pte)); - set_pte_at(mm, addr, pte, entry); -@@ -2038,36 +2065,6 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd, - } - - smp_wmb(); /* make pte visible before pmd */ -- /* -- * Up to this point the pmd is present and huge and userland has the -- * whole access to the hugepage during the split (which happens in -- * place). If we overwrite the pmd with the not-huge version pointing -- * to the pte here (which of course we could if all CPUs were bug -- * free), userland could trigger a small page size TLB miss on the -- * small sized TLB while the hugepage TLB entry is still established in -- * the huge TLB. Some CPU doesn't like that. -- * See http://support.amd.com/us/Processor_TechDocs/41322.pdf, Erratum -- * 383 on page 93. Intel should be safe but is also warns that it's -- * only safe if the permission and cache attributes of the two entries -- * loaded in the two TLB is identical (which should be the case here). -- * But it is generally safer to never allow small and huge TLB entries -- * for the same virtual address to be loaded simultaneously. So instead -- * of doing "pmd_populate(); flush_pmd_tlb_range();" we first mark the -- * current pmd notpresent (atomically because here the pmd_trans_huge -- * and pmd_trans_splitting must remain set at all times on the pmd -- * until the split is complete for this pmd), then we flush the SMP TLB -- * and finally we write the non-huge version of the pmd entry with -- * pmd_populate. -- */ -- old = pmdp_invalidate(vma, haddr, pmd); -- -- /* -- * Transfer dirty bit using value returned by pmd_invalidate() to be -- * sure we don't race with CPU that can set the bit under us. -- */ -- if (pmd_dirty(old)) -- SetPageDirty(page); -- - pmd_populate(mm, pmd, pgtable); - - if (freeze) { --- -2.13.5 - - --- -To unsubscribe, send a message with 'unsubscribe linux-mm' in -the body to majordomo@kvack.org. For more info on Linux MM, -see: http://www.linux-mm.org/ . -Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> diff --git a/a/content_digest b/N1/content_digest index ca6e9eb..745712a 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -3,7 +3,8 @@ "From\0Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>\0" "Subject\0Re: [PATCHv3 11/11] mm: Use updated pmdp_invalidate() interface to track dirty/accessed bits\0" "Date\0Wed, 13 Sep 2017 07:38:58 +0530\0" - "To\0Andrew Morton <akpm@linux-foundation.org>" + "To\0Kirill A. Shutemov <kirill.shutemov@linux.intel.com>" + Andrew Morton <akpm@linux-foundation.org> Vlastimil Babka <vbabka@suse.cz> Vineet Gupta <vgupta@synopsys.com> Russell King <linux@armlinux.org.uk> @@ -16,264 +17,10 @@ " Andrea Arcangeli <aarcange@redhat.com>\0" "Cc\0linux-arch@vger.kernel.org" linux-mm@kvack.org - linux-kernel@vger.kernel.org - " Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\0" + " linux-kernel@vger.kernel.org\0" "\00:1\0" "b\0" "\n" - "How about this additional patch ?. This results in code reduction.\n" - "\n" - "From fed62d0541ae78206a1a25caeb46a3ffa7ade9c8 Mon Sep 17 00:00:00 2001\n" - "From: \"Aneesh Kumar K.V\" <aneesh.kumar@linux.vnet.ibm.com>\n" - "Date: Thu, 27 Jul 2017 12:21:33 +0530\n" - "Subject: [PATCH] mm/thp: Remove pmd_huge_split_prepare\n" - "\n" - "Instead of marking the pmd ready for split, invalidate the pmd. This should\n" - "take care of powerpc requirement. Only side effect is that we mark the pmd\n" - "invalid early. This can result in us blocking access to the page a bit longer\n" - "if we race against a thp split.\n" - "\n" - "Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>\n" - "---\n" - " arch/powerpc/include/asm/book3s/64/hash-4k.h | 2 -\n" - " arch/powerpc/include/asm/book3s/64/hash-64k.h | 2 -\n" - " arch/powerpc/include/asm/book3s/64/pgtable.h | 9 ----\n" - " arch/powerpc/include/asm/book3s/64/radix.h | 6 ---\n" - " arch/powerpc/mm/pgtable-hash64.c | 22 --------\n" - " include/asm-generic/pgtable.h | 8 ---\n" - " mm/huge_memory.c | 73 +++++++++++++--------------\n" - " 7 files changed, 35 insertions(+), 87 deletions(-)\n" - "\n" - "diff --git a/arch/powerpc/include/asm/book3s/64/hash-4k.h b/arch/powerpc/include/asm/book3s/64/hash-4k.h\n" - "index d65dcb5826ff..2416edb74d28 100644\n" - "--- a/arch/powerpc/include/asm/book3s/64/hash-4k.h\n" - "+++ b/arch/powerpc/include/asm/book3s/64/hash-4k.h\n" - "@@ -112,8 +112,6 @@ extern pmd_t hash__pmdp_collapse_flush(struct vm_area_struct *vma,\n" - " extern void hash__pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,\n" - " \t\t\t\t\t pgtable_t pgtable);\n" - " extern pgtable_t hash__pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp);\n" - "-extern void hash__pmdp_huge_split_prepare(struct vm_area_struct *vma,\n" - "-\t\t\t\t unsigned long address, pmd_t *pmdp);\n" - " extern pmd_t hash__pmdp_huge_get_and_clear(struct mm_struct *mm,\n" - " \t\t\t\t unsigned long addr, pmd_t *pmdp);\n" - " extern int hash__has_transparent_hugepage(void);\n" - "diff --git a/arch/powerpc/include/asm/book3s/64/hash-64k.h b/arch/powerpc/include/asm/book3s/64/hash-64k.h\n" - "index ab36323b8a3e..001202cabedf 100644\n" - "--- a/arch/powerpc/include/asm/book3s/64/hash-64k.h\n" - "+++ b/arch/powerpc/include/asm/book3s/64/hash-64k.h\n" - "@@ -162,8 +162,6 @@ extern pmd_t hash__pmdp_collapse_flush(struct vm_area_struct *vma,\n" - " extern void hash__pgtable_trans_huge_deposit(struct mm_struct *mm, pmd_t *pmdp,\n" - " \t\t\t\t\t pgtable_t pgtable);\n" - " extern pgtable_t hash__pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp);\n" - "-extern void hash__pmdp_huge_split_prepare(struct vm_area_struct *vma,\n" - "-\t\t\t\t unsigned long address, pmd_t *pmdp);\n" - " extern pmd_t hash__pmdp_huge_get_and_clear(struct mm_struct *mm,\n" - " \t\t\t\t unsigned long addr, pmd_t *pmdp);\n" - " extern int hash__has_transparent_hugepage(void);\n" - "diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h\n" - "index 6cf53dc70efc..fee01ffe3b60 100644\n" - "--- a/arch/powerpc/include/asm/book3s/64/pgtable.h\n" - "+++ b/arch/powerpc/include/asm/book3s/64/pgtable.h\n" - "@@ -1114,15 +1114,6 @@ static inline pgtable_t pgtable_trans_huge_withdraw(struct mm_struct *mm,\n" - " extern pmd_t pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,\n" - " \t\t\t pmd_t *pmdp);\n" - " \n" - "-#define __HAVE_ARCH_PMDP_HUGE_SPLIT_PREPARE\n" - "-static inline void pmdp_huge_split_prepare(struct vm_area_struct *vma,\n" - "-\t\t\t\t\t unsigned long address, pmd_t *pmdp)\n" - "-{\n" - "-\tif (radix_enabled())\n" - "-\t\treturn radix__pmdp_huge_split_prepare(vma, address, pmdp);\n" - "-\treturn hash__pmdp_huge_split_prepare(vma, address, pmdp);\n" - "-}\n" - "-\n" - " #define pmd_move_must_withdraw pmd_move_must_withdraw\n" - " struct spinlock;\n" - " static inline int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl,\n" - "diff --git a/arch/powerpc/include/asm/book3s/64/radix.h b/arch/powerpc/include/asm/book3s/64/radix.h\n" - "index f5ece365d929..389be8b6c9f7 100644\n" - "--- a/arch/powerpc/include/asm/book3s/64/radix.h\n" - "+++ b/arch/powerpc/include/asm/book3s/64/radix.h\n" - "@@ -272,12 +272,6 @@ static inline pmd_t radix__pmd_mkhuge(pmd_t pmd)\n" - " \t\treturn __pmd(pmd_val(pmd) | _PAGE_PTE | R_PAGE_LARGE);\n" - " \treturn __pmd(pmd_val(pmd) | _PAGE_PTE);\n" - " }\n" - "-static inline void radix__pmdp_huge_split_prepare(struct vm_area_struct *vma,\n" - "-\t\t\t\t\t unsigned long address, pmd_t *pmdp)\n" - "-{\n" - "-\t/* Nothing to do for radix. */\n" - "-\treturn;\n" - "-}\n" - " \n" - " extern unsigned long radix__pmd_hugepage_update(struct mm_struct *mm, unsigned long addr,\n" - " \t\t\t\t\t pmd_t *pmdp, unsigned long clr,\n" - "diff --git a/arch/powerpc/mm/pgtable-hash64.c b/arch/powerpc/mm/pgtable-hash64.c\n" - "index ec277913e01b..469808e77e58 100644\n" - "--- a/arch/powerpc/mm/pgtable-hash64.c\n" - "+++ b/arch/powerpc/mm/pgtable-hash64.c\n" - "@@ -296,28 +296,6 @@ pgtable_t hash__pgtable_trans_huge_withdraw(struct mm_struct *mm, pmd_t *pmdp)\n" - " \treturn pgtable;\n" - " }\n" - " \n" - "-void hash__pmdp_huge_split_prepare(struct vm_area_struct *vma,\n" - "-\t\t\t unsigned long address, pmd_t *pmdp)\n" - "-{\n" - "-\tVM_BUG_ON(address & ~HPAGE_PMD_MASK);\n" - "-\tVM_BUG_ON(REGION_ID(address) != USER_REGION_ID);\n" - "-\tVM_BUG_ON(pmd_devmap(*pmdp));\n" - "-\n" - "-\t/*\n" - "-\t * We can't mark the pmd none here, because that will cause a race\n" - "-\t * against exit_mmap. We need to continue mark pmd TRANS HUGE, while\n" - "-\t * we spilt, but at the same time we wan't rest of the ppc64 code\n" - "-\t * not to insert hash pte on this, because we will be modifying\n" - "-\t * the deposited pgtable in the caller of this function. Hence\n" - "-\t * clear the _PAGE_USER so that we move the fault handling to\n" - "-\t * higher level function and that will serialize against ptl.\n" - "-\t * We need to flush existing hash pte entries here even though,\n" - "-\t * the translation is still valid, because we will withdraw\n" - "-\t * pgtable_t after this.\n" - "-\t */\n" - "-\tpmd_hugepage_update(vma->vm_mm, address, pmdp, 0, _PAGE_PRIVILEGED);\n" - "-}\n" - "-\n" - " /*\n" - " * A linux hugepage PMD was changed and the corresponding hash table entries\n" - " * neesd to be flushed.\n" - "diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h\n" - "index ece5e399567a..b934e41277ac 100644\n" - "--- a/include/asm-generic/pgtable.h\n" - "+++ b/include/asm-generic/pgtable.h\n" - "@@ -313,14 +313,6 @@ extern pmd_t pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,\n" - " \t\t\t pmd_t *pmdp);\n" - " #endif\n" - " \n" - "-#ifndef __HAVE_ARCH_PMDP_HUGE_SPLIT_PREPARE\n" - "-static inline void pmdp_huge_split_prepare(struct vm_area_struct *vma,\n" - "-\t\t\t\t\t unsigned long address, pmd_t *pmdp)\n" - "-{\n" - "-\n" - "-}\n" - "-#endif\n" - "-\n" - " #ifndef __HAVE_ARCH_PTE_SAME\n" - " static inline int pte_same(pte_t pte_a, pte_t pte_b)\n" - " {\n" - "diff --git a/mm/huge_memory.c b/mm/huge_memory.c\n" - "index d72c2d20e9c6..59ec8c916368 100644\n" - "--- a/mm/huge_memory.c\n" - "+++ b/mm/huge_memory.c\n" - "@@ -1944,8 +1944,8 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,\n" - " \tstruct mm_struct *mm = vma->vm_mm;\n" - " \tstruct page *page;\n" - " \tpgtable_t pgtable;\n" - "-\tpmd_t old, _pmd;\n" - "-\tbool young, write, soft_dirty;\n" - "+\tpmd_t old_pmd, _pmd;\n" - "+\tbool young, write, dirty, soft_dirty;\n" - " \tunsigned long addr;\n" - " \tint i;\n" - " \n" - "@@ -1977,14 +1977,39 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,\n" - " \t\treturn __split_huge_zero_page_pmd(vma, haddr, pmd);\n" - " \t}\n" - " \n" - "-\tpage = pmd_page(*pmd);\n" - "+\t/*\n" - "+\t * Up to this point the pmd is present and huge and userland has the\n" - "+\t * whole access to the hugepage during the split (which happens in\n" - "+\t * place). If we overwrite the pmd with the not-huge version pointing\n" - "+\t * to the pte here (which of course we could if all CPUs were bug\n" - "+\t * free), userland could trigger a small page size TLB miss on the\n" - "+\t * small sized TLB while the hugepage TLB entry is still established in\n" - "+\t * the huge TLB. Some CPU doesn't like that.\n" - "+\t * See http://support.amd.com/us/Processor_TechDocs/41322.pdf, Erratum\n" - "+\t * 383 on page 93. Intel should be safe but is also warns that it's\n" - "+\t * only safe if the permission and cache attributes of the two entries\n" - "+\t * loaded in the two TLB is identical (which should be the case here).\n" - "+\t * But it is generally safer to never allow small and huge TLB entries\n" - "+\t * for the same virtual address to be loaded simultaneously. So instead\n" - "+\t * of doing \"pmd_populate(); flush_pmd_tlb_range();\" we first mark the\n" - "+\t * current pmd notpresent (atomically because here the pmd_trans_huge\n" - "+\t * and pmd_trans_splitting must remain set at all times on the pmd\n" - "+\t * until the split is complete for this pmd), then we flush the SMP TLB\n" - "+\t * and finally we write the non-huge version of the pmd entry with\n" - "+\t * pmd_populate.\n" - "+\t */\n" - "+\told_pmd = pmdp_invalidate(vma, haddr, pmd);\n" - "+\n" - "+\tpage = pmd_page(old_pmd);\n" - " \tVM_BUG_ON_PAGE(!page_count(page), page);\n" - " \tpage_ref_add(page, HPAGE_PMD_NR - 1);\n" - "-\twrite = pmd_write(*pmd);\n" - "-\tyoung = pmd_young(*pmd);\n" - "-\tsoft_dirty = pmd_soft_dirty(*pmd);\n" - "-\n" - "-\tpmdp_huge_split_prepare(vma, haddr, pmd);\n" - "+\twrite = pmd_write(old_pmd);\n" - "+\tyoung = pmd_young(old_pmd);\n" - "+\tdirty = pmd_dirty(old_pmd);\n" - "+\tsoft_dirty = pmd_soft_dirty(old_pmd);\n" - "+\t/*\n" - "+\t * withdraw the table only after we mark the pmd entry invalid\n" - "+\t */\n" - " \tpgtable = pgtable_trans_huge_withdraw(mm, pmd);\n" - " \tpmd_populate(mm, &_pmd, pgtable);\n" - " \n" - "@@ -2011,6 +2036,8 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,\n" - " \t\t\tif (soft_dirty)\n" - " \t\t\t\tentry = pte_mksoft_dirty(entry);\n" - " \t\t}\n" - "+\t\tif (dirty)\n" - "+\t\t\tSetPageDirty(page + i);\n" - " \t\tpte = pte_offset_map(&_pmd, addr);\n" - " \t\tBUG_ON(!pte_none(*pte));\n" - " \t\tset_pte_at(mm, addr, pte, entry);\n" - "@@ -2038,36 +2065,6 @@ static void __split_huge_pmd_locked(struct vm_area_struct *vma, pmd_t *pmd,\n" - " \t}\n" - " \n" - " \tsmp_wmb(); /* make pte visible before pmd */\n" - "-\t/*\n" - "-\t * Up to this point the pmd is present and huge and userland has the\n" - "-\t * whole access to the hugepage during the split (which happens in\n" - "-\t * place). If we overwrite the pmd with the not-huge version pointing\n" - "-\t * to the pte here (which of course we could if all CPUs were bug\n" - "-\t * free), userland could trigger a small page size TLB miss on the\n" - "-\t * small sized TLB while the hugepage TLB entry is still established in\n" - "-\t * the huge TLB. Some CPU doesn't like that.\n" - "-\t * See http://support.amd.com/us/Processor_TechDocs/41322.pdf, Erratum\n" - "-\t * 383 on page 93. Intel should be safe but is also warns that it's\n" - "-\t * only safe if the permission and cache attributes of the two entries\n" - "-\t * loaded in the two TLB is identical (which should be the case here).\n" - "-\t * But it is generally safer to never allow small and huge TLB entries\n" - "-\t * for the same virtual address to be loaded simultaneously. So instead\n" - "-\t * of doing \"pmd_populate(); flush_pmd_tlb_range();\" we first mark the\n" - "-\t * current pmd notpresent (atomically because here the pmd_trans_huge\n" - "-\t * and pmd_trans_splitting must remain set at all times on the pmd\n" - "-\t * until the split is complete for this pmd), then we flush the SMP TLB\n" - "-\t * and finally we write the non-huge version of the pmd entry with\n" - "-\t * pmd_populate.\n" - "-\t */\n" - "-\told = pmdp_invalidate(vma, haddr, pmd);\n" - "-\n" - "-\t/*\n" - "-\t * Transfer dirty bit using value returned by pmd_invalidate() to be\n" - "-\t * sure we don't race with CPU that can set the bit under us.\n" - "-\t */\n" - "-\tif (pmd_dirty(old))\n" - "-\t\tSetPageDirty(page);\n" - "-\n" - " \tpmd_populate(mm, pmd, pgtable);\n" - " \n" - " \tif (freeze) {\n" - "-- \n" - "2.13.5\n" - "\n" - "\n" - "--\n" - "To unsubscribe, send a message with 'unsubscribe linux-mm' in\n" - "the body to majordomo@kvack.org. For more info on Linux MM,\n" - "see: http://www.linux-mm.org/ .\n" - "Don't email: <a href=mailto:\"dont@kvack.org\"> email@kvack.org </a>" + How about this additional patch ?. This results in code reduction. -e564a9c84e29fa4721e56f23303512d209b9d29ebda46b9a7630011ad1d31224 +fc364d3acc9f601731a4da8a0c4795923f9518611fef7479fd962be85e2ab46e
diff --git a/a/1.txt b/N2/1.txt index 1905329..a82fb09 100644 --- a/a/1.txt +++ b/N2/1.txt @@ -1,7 +1,7 @@ How about this additional patch ?. This results in code reduction. -From fed62d0541ae78206a1a25caeb46a3ffa7ade9c8 Mon Sep 17 00:00:00 2001 +>From fed62d0541ae78206a1a25caeb46a3ffa7ade9c8 Mon Sep 17 00:00:00 2001 From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> Date: Thu, 27 Jul 2017 12:21:33 +0530 Subject: [PATCH] mm/thp: Remove pmd_huge_split_prepare @@ -246,10 +246,3 @@ index d72c2d20e9c6..59ec8c916368 100644 if (freeze) { -- 2.13.5 - - --- -To unsubscribe, send a message with 'unsubscribe linux-mm' in -the body to majordomo@kvack.org. For more info on Linux MM, -see: http://www.linux-mm.org/ . -Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> diff --git a/a/content_digest b/N2/content_digest index ca6e9eb..6ed71e2 100644 --- a/a/content_digest +++ b/N2/content_digest @@ -3,7 +3,8 @@ "From\0Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>\0" "Subject\0Re: [PATCHv3 11/11] mm: Use updated pmdp_invalidate() interface to track dirty/accessed bits\0" "Date\0Wed, 13 Sep 2017 07:38:58 +0530\0" - "To\0Andrew Morton <akpm@linux-foundation.org>" + "To\0Kirill A. Shutemov <kirill.shutemov@linux.intel.com>" + Andrew Morton <akpm@linux-foundation.org> Vlastimil Babka <vbabka@suse.cz> Vineet Gupta <vgupta@synopsys.com> Russell King <linux@armlinux.org.uk> @@ -23,7 +24,7 @@ "\n" "How about this additional patch ?. This results in code reduction.\n" "\n" - "From fed62d0541ae78206a1a25caeb46a3ffa7ade9c8 Mon Sep 17 00:00:00 2001\n" + ">From fed62d0541ae78206a1a25caeb46a3ffa7ade9c8 Mon Sep 17 00:00:00 2001\n" "From: \"Aneesh Kumar K.V\" <aneesh.kumar@linux.vnet.ibm.com>\n" "Date: Thu, 27 Jul 2017 12:21:33 +0530\n" "Subject: [PATCH] mm/thp: Remove pmd_huge_split_prepare\n" @@ -267,13 +268,6 @@ " \n" " \tif (freeze) {\n" "-- \n" - "2.13.5\n" - "\n" - "\n" - "--\n" - "To unsubscribe, send a message with 'unsubscribe linux-mm' in\n" - "the body to majordomo@kvack.org. For more info on Linux MM,\n" - "see: http://www.linux-mm.org/ .\n" - "Don't email: <a href=mailto:\"dont@kvack.org\"> email@kvack.org </a>" + 2.13.5 -e564a9c84e29fa4721e56f23303512d209b9d29ebda46b9a7630011ad1d31224 +2b8855e9f760dcf39a8d399ad347ded8f0e2db952bad3e7096c738eb2cbeb3c8
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.