diff for duplicates of <1487044732.21048.23.camel@neuling.org> diff --git a/a/1.txt b/N1/1.txt index 90bd471..dd34ff9 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -1,18 +1,13 @@ On Thu, 2017-02-09 at 08:30 +0530, Aneesh Kumar K.V wrote: > Autonuma preserves the write permission across numa fault to avoid taking -> a writefault after a numa fault (Commit: b191f9b106ea " mm: numa: preserv= -e PTE -> write permissions across a NUMA hinting fault"). Architecture can impleme= -nt -> protnone in different ways and some may choose to implement that by clear= -ing +> a writefault after a numa fault (Commit: b191f9b106ea " mm: numa: preserve PTE +> write permissions across a NUMA hinting fault"). Architecture can implement +> protnone in different ways and some may choose to implement that by clearing > Read/ -> Write/Exec bit of pte. Setting the write bit on such pte can result in wr= -ong -> behaviour. Fix this up by allowing arch to override how to save the write= - bit +> Write/Exec bit of pte. Setting the write bit on such pte can result in wrong +> behaviour. Fix this up by allowing arch to override how to save the write bit > on a protnone pte. ->=20 +> > Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> FWIW this is pretty simple and helps with us in powerpc... @@ -20,27 +15,21 @@ FWIW this is pretty simple and helps with us in powerpc... Acked-By: Michael Neuling <mikey@neuling.org> > --- -> =C2=A0include/asm-generic/pgtable.h | 16 ++++++++++++++++ -> =C2=A0mm/huge_memory.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= -=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2=A04 ++-- -> =C2=A0mm/memory.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2=A02 = -+- -> =C2=A0mm/mprotect.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2=A04 ++-- -> =C2=A04 files changed, 21 insertions(+), 5 deletions(-) ->=20 -> diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.= -h +> include/asm-generic/pgtable.h | 16 ++++++++++++++++ +> mm/huge_memory.c | 4 ++-- +> mm/memory.c | 2 +- +> mm/mprotect.c | 4 ++-- +> 4 files changed, 21 insertions(+), 5 deletions(-) +> +> diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h > index 18af2bcefe6a..b6f3a8a4b738 100644 > --- a/include/asm-generic/pgtable.h > +++ b/include/asm-generic/pgtable.h -> @@ -192,6 +192,22 @@ static inline void ptep_set_wrprotect(struct mm_stru= -ct +> @@ -192,6 +192,22 @@ static inline void ptep_set_wrprotect(struct mm_struct > *mm, unsigned long addres -> =C2=A0} -> =C2=A0#endif -> =C2=A0 +> } +> #endif +> > +#ifndef pte_savedwrite > +#define pte_savedwrite pte_write > +#endif @@ -57,67 +46,71 @@ ct > +#define pmd_mk_savedwrite pmd_mkwrite > +#endif > + -> =C2=A0#ifndef __HAVE_ARCH_PMDP_SET_WRPROTECT -> =C2=A0#ifdef CONFIG_TRANSPARENT_HUGEPAGE -> =C2=A0static inline void pmdp_set_wrprotect(struct mm_struct *mm, +> #ifndef __HAVE_ARCH_PMDP_SET_WRPROTECT +> #ifdef CONFIG_TRANSPARENT_HUGEPAGE +> static inline void pmdp_set_wrprotect(struct mm_struct *mm, > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > index 9a6bd6c8d55a..2f0f855ec911 100644 > --- a/mm/huge_memory.c > +++ b/mm/huge_memory.c -> @@ -1300,7 +1300,7 @@ int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd= -_t +> @@ -1300,7 +1300,7 @@ int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t > pmd) -> =C2=A0 goto out; -> =C2=A0clear_pmdnuma: -> =C2=A0 BUG_ON(!PageLocked(page)); -> - was_writable =3D pmd_write(pmd); -> + was_writable =3D pmd_savedwrite(pmd); -> =C2=A0 pmd =3D pmd_modify(pmd, vma->vm_page_prot); -> =C2=A0 pmd =3D pmd_mkyoung(pmd); -> =C2=A0 if (was_writable) -> @@ -1555,7 +1555,7 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd= -_t +> goto out; +> clear_pmdnuma: +> BUG_ON(!PageLocked(page)); +> - was_writable = pmd_write(pmd); +> + was_writable = pmd_savedwrite(pmd); +> pmd = pmd_modify(pmd, vma->vm_page_prot); +> pmd = pmd_mkyoung(pmd); +> if (was_writable) +> @@ -1555,7 +1555,7 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd_t > *pmd, -> =C2=A0 entry =3D pmdp_huge_get_and_clear_notify(mm, addr, +> entry = pmdp_huge_get_and_clear_notify(mm, addr, > pmd); -> =C2=A0 entry =3D pmd_modify(entry, newprot); -> =C2=A0 if (preserve_write) -> - entry =3D pmd_mkwrite(entry); -> + entry =3D pmd_mk_savedwrite(entry); -> =C2=A0 ret =3D HPAGE_PMD_NR; -> =C2=A0 set_pmd_at(mm, addr, pmd, entry); -> =C2=A0 BUG_ON(vma_is_anonymous(vma) && !preserve_write && +> entry = pmd_modify(entry, newprot); +> if (preserve_write) +> - entry = pmd_mkwrite(entry); +> + entry = pmd_mk_savedwrite(entry); +> ret = HPAGE_PMD_NR; +> set_pmd_at(mm, addr, pmd, entry); +> BUG_ON(vma_is_anonymous(vma) && !preserve_write && > diff --git a/mm/memory.c b/mm/memory.c > index e78bf72f30dd..88c24f89d6d3 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -3388,7 +3388,7 @@ static int do_numa_page(struct vm_fault *vmf) -> =C2=A0 int target_nid; -> =C2=A0 bool migrated =3D false; -> =C2=A0 pte_t pte; -> - bool was_writable =3D pte_write(vmf->orig_pte); -> + bool was_writable =3D pte_savedwrite(vmf->orig_pte); -> =C2=A0 int flags =3D 0; -> =C2=A0 -> =C2=A0 /* +> int target_nid; +> bool migrated = false; +> pte_t pte; +> - bool was_writable = pte_write(vmf->orig_pte); +> + bool was_writable = pte_savedwrite(vmf->orig_pte); +> int flags = 0; +> +> /* > diff --git a/mm/mprotect.c b/mm/mprotect.c > index f9c07f54dd62..15f5c174a7c1 100644 > --- a/mm/mprotect.c > +++ b/mm/mprotect.c > @@ -113,13 +113,13 @@ static unsigned long change_pte_range(struct > vm_area_struct *vma, pmd_t *pmd, -> =C2=A0 ptent =3D ptep_modify_prot_start(mm, addr, pte); -> =C2=A0 ptent =3D pte_modify(ptent, newprot); -> =C2=A0 if (preserve_write) -> - ptent =3D pte_mkwrite(ptent); -> + ptent =3D pte_mk_savedwrite(ptent); -> =C2=A0 -> =C2=A0 /* Avoid taking write faults for known dirty pages */ -> =C2=A0 if (dirty_accountable && pte_dirty(ptent) && -> =C2=A0 (pte_soft_dirty(ptent) || -> =C2=A0 =C2=A0!(vma->vm_flags & VM_SOFTDIRTY))) { -> - ptent =3D pte_mkwrite(ptent); -> + ptent =3D pte_mk_savedwrite(ptent); -> =C2=A0 } -> =C2=A0 ptep_modify_prot_commit(mm, addr, pte, ptent); -> =C2=A0 pages++; +> ptent = ptep_modify_prot_start(mm, addr, pte); +> ptent = pte_modify(ptent, newprot); +> if (preserve_write) +> - ptent = pte_mkwrite(ptent); +> + ptent = pte_mk_savedwrite(ptent); +> +> /* Avoid taking write faults for known dirty pages */ +> if (dirty_accountable && pte_dirty(ptent) && +> (pte_soft_dirty(ptent) || +> !(vma->vm_flags & VM_SOFTDIRTY))) { +> - ptent = pte_mkwrite(ptent); +> + ptent = pte_mk_savedwrite(ptent); +> } +> ptep_modify_prot_commit(mm, addr, pte, ptent); +> pages++; + +-- +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 14e3aaf..c33cb56 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -15,19 +15,14 @@ "b\0" "On Thu, 2017-02-09 at 08:30 +0530, Aneesh Kumar K.V wrote:\n" "> Autonuma preserves the write permission across numa fault to avoid taking\n" - "> a writefault after a numa fault (Commit: b191f9b106ea \" mm: numa: preserv=\n" - "e PTE\n" - "> write permissions across a NUMA hinting fault\"). Architecture can impleme=\n" - "nt\n" - "> protnone in different ways and some may choose to implement that by clear=\n" - "ing\n" + "> a writefault after a numa fault (Commit: b191f9b106ea \" mm: numa: preserve PTE\n" + "> write permissions across a NUMA hinting fault\"). Architecture can implement\n" + "> protnone in different ways and some may choose to implement that by clearing\n" "> Read/\n" - "> Write/Exec bit of pte. Setting the write bit on such pte can result in wr=\n" - "ong\n" - "> behaviour. Fix this up by allowing arch to override how to save the write=\n" - " bit\n" + "> Write/Exec bit of pte. Setting the write bit on such pte can result in wrong\n" + "> behaviour. Fix this up by allowing arch to override how to save the write bit\n" "> on a protnone pte.\n" - ">=20\n" + "> \n" "> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>\n" "\n" "FWIW this is pretty simple and helps with us in powerpc...\n" @@ -35,27 +30,21 @@ "Acked-By: Michael Neuling <mikey@neuling.org>\n" "\n" "> ---\n" - "> =C2=A0include/asm-generic/pgtable.h | 16 ++++++++++++++++\n" - "> =C2=A0mm/huge_memory.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=\n" - "=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2=A04 ++--\n" - "> =C2=A0mm/memory.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=\n" - "=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2=A02 =\n" - "+-\n" - "> =C2=A0mm/mprotect.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=\n" - "=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2=A04 ++--\n" - "> =C2=A04 files changed, 21 insertions(+), 5 deletions(-)\n" - ">=20\n" - "> diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.=\n" - "h\n" + "> \302\240include/asm-generic/pgtable.h | 16 ++++++++++++++++\n" + "> \302\240mm/huge_memory.c\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240|\302\240\302\2404 ++--\n" + "> \302\240mm/memory.c\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240|\302\240\302\2402 +-\n" + "> \302\240mm/mprotect.c\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240|\302\240\302\2404 ++--\n" + "> \302\2404 files changed, 21 insertions(+), 5 deletions(-)\n" + "> \n" + "> diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h\n" "> index 18af2bcefe6a..b6f3a8a4b738 100644\n" "> --- a/include/asm-generic/pgtable.h\n" "> +++ b/include/asm-generic/pgtable.h\n" - "> @@ -192,6 +192,22 @@ static inline void ptep_set_wrprotect(struct mm_stru=\n" - "ct\n" + "> @@ -192,6 +192,22 @@ static inline void ptep_set_wrprotect(struct mm_struct\n" "> *mm, unsigned long addres\n" - "> =C2=A0}\n" - "> =C2=A0#endif\n" - "> =C2=A0\n" + "> \302\240}\n" + "> \302\240#endif\n" + "> \302\240\n" "> +#ifndef pte_savedwrite\n" "> +#define pte_savedwrite pte_write\n" "> +#endif\n" @@ -72,69 +61,73 @@ "> +#define pmd_mk_savedwrite pmd_mkwrite\n" "> +#endif\n" "> +\n" - "> =C2=A0#ifndef __HAVE_ARCH_PMDP_SET_WRPROTECT\n" - "> =C2=A0#ifdef CONFIG_TRANSPARENT_HUGEPAGE\n" - "> =C2=A0static inline void pmdp_set_wrprotect(struct mm_struct *mm,\n" + "> \302\240#ifndef __HAVE_ARCH_PMDP_SET_WRPROTECT\n" + "> \302\240#ifdef CONFIG_TRANSPARENT_HUGEPAGE\n" + "> \302\240static inline void pmdp_set_wrprotect(struct mm_struct *mm,\n" "> diff --git a/mm/huge_memory.c b/mm/huge_memory.c\n" "> index 9a6bd6c8d55a..2f0f855ec911 100644\n" "> --- a/mm/huge_memory.c\n" "> +++ b/mm/huge_memory.c\n" - "> @@ -1300,7 +1300,7 @@ int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd=\n" - "_t\n" + "> @@ -1300,7 +1300,7 @@ int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t\n" "> pmd)\n" - "> =C2=A0\tgoto out;\n" - "> =C2=A0clear_pmdnuma:\n" - "> =C2=A0\tBUG_ON(!PageLocked(page));\n" - "> -\twas_writable =3D pmd_write(pmd);\n" - "> +\twas_writable =3D pmd_savedwrite(pmd);\n" - "> =C2=A0\tpmd =3D pmd_modify(pmd, vma->vm_page_prot);\n" - "> =C2=A0\tpmd =3D pmd_mkyoung(pmd);\n" - "> =C2=A0\tif (was_writable)\n" - "> @@ -1555,7 +1555,7 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd=\n" - "_t\n" + "> \302\240\tgoto out;\n" + "> \302\240clear_pmdnuma:\n" + "> \302\240\tBUG_ON(!PageLocked(page));\n" + "> -\twas_writable = pmd_write(pmd);\n" + "> +\twas_writable = pmd_savedwrite(pmd);\n" + "> \302\240\tpmd = pmd_modify(pmd, vma->vm_page_prot);\n" + "> \302\240\tpmd = pmd_mkyoung(pmd);\n" + "> \302\240\tif (was_writable)\n" + "> @@ -1555,7 +1555,7 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd_t\n" "> *pmd,\n" - "> =C2=A0\t\t\tentry =3D pmdp_huge_get_and_clear_notify(mm, addr,\n" + "> \302\240\t\t\tentry = pmdp_huge_get_and_clear_notify(mm, addr,\n" "> pmd);\n" - "> =C2=A0\t\t\tentry =3D pmd_modify(entry, newprot);\n" - "> =C2=A0\t\t\tif (preserve_write)\n" - "> -\t\t\t\tentry =3D pmd_mkwrite(entry);\n" - "> +\t\t\t\tentry =3D pmd_mk_savedwrite(entry);\n" - "> =C2=A0\t\t\tret =3D HPAGE_PMD_NR;\n" - "> =C2=A0\t\t\tset_pmd_at(mm, addr, pmd, entry);\n" - "> =C2=A0\t\t\tBUG_ON(vma_is_anonymous(vma) && !preserve_write &&\n" + "> \302\240\t\t\tentry = pmd_modify(entry, newprot);\n" + "> \302\240\t\t\tif (preserve_write)\n" + "> -\t\t\t\tentry = pmd_mkwrite(entry);\n" + "> +\t\t\t\tentry = pmd_mk_savedwrite(entry);\n" + "> \302\240\t\t\tret = HPAGE_PMD_NR;\n" + "> \302\240\t\t\tset_pmd_at(mm, addr, pmd, entry);\n" + "> \302\240\t\t\tBUG_ON(vma_is_anonymous(vma) && !preserve_write &&\n" "> diff --git a/mm/memory.c b/mm/memory.c\n" "> index e78bf72f30dd..88c24f89d6d3 100644\n" "> --- a/mm/memory.c\n" "> +++ b/mm/memory.c\n" "> @@ -3388,7 +3388,7 @@ static int do_numa_page(struct vm_fault *vmf)\n" - "> =C2=A0\tint target_nid;\n" - "> =C2=A0\tbool migrated =3D false;\n" - "> =C2=A0\tpte_t pte;\n" - "> -\tbool was_writable =3D pte_write(vmf->orig_pte);\n" - "> +\tbool was_writable =3D pte_savedwrite(vmf->orig_pte);\n" - "> =C2=A0\tint flags =3D 0;\n" - "> =C2=A0\n" - "> =C2=A0\t/*\n" + "> \302\240\tint target_nid;\n" + "> \302\240\tbool migrated = false;\n" + "> \302\240\tpte_t pte;\n" + "> -\tbool was_writable = pte_write(vmf->orig_pte);\n" + "> +\tbool was_writable = pte_savedwrite(vmf->orig_pte);\n" + "> \302\240\tint flags = 0;\n" + "> \302\240\n" + "> \302\240\t/*\n" "> diff --git a/mm/mprotect.c b/mm/mprotect.c\n" "> index f9c07f54dd62..15f5c174a7c1 100644\n" "> --- a/mm/mprotect.c\n" "> +++ b/mm/mprotect.c\n" "> @@ -113,13 +113,13 @@ static unsigned long change_pte_range(struct\n" "> vm_area_struct *vma, pmd_t *pmd,\n" - "> =C2=A0\t\t\tptent =3D ptep_modify_prot_start(mm, addr, pte);\n" - "> =C2=A0\t\t\tptent =3D pte_modify(ptent, newprot);\n" - "> =C2=A0\t\t\tif (preserve_write)\n" - "> -\t\t\t\tptent =3D pte_mkwrite(ptent);\n" - "> +\t\t\t\tptent =3D pte_mk_savedwrite(ptent);\n" - "> =C2=A0\n" - "> =C2=A0\t\t\t/* Avoid taking write faults for known dirty pages */\n" - "> =C2=A0\t\t\tif (dirty_accountable && pte_dirty(ptent) &&\n" - "> =C2=A0\t\t\t\t\t(pte_soft_dirty(ptent) ||\n" - "> =C2=A0\t\t\t\t\t=C2=A0!(vma->vm_flags & VM_SOFTDIRTY))) {\n" - "> -\t\t\t\tptent =3D pte_mkwrite(ptent);\n" - "> +\t\t\t\tptent =3D pte_mk_savedwrite(ptent);\n" - "> =C2=A0\t\t\t}\n" - "> =C2=A0\t\t\tptep_modify_prot_commit(mm, addr, pte, ptent);\n" - "> =C2=A0\t\t\tpages++;" + "> \302\240\t\t\tptent = ptep_modify_prot_start(mm, addr, pte);\n" + "> \302\240\t\t\tptent = pte_modify(ptent, newprot);\n" + "> \302\240\t\t\tif (preserve_write)\n" + "> -\t\t\t\tptent = pte_mkwrite(ptent);\n" + "> +\t\t\t\tptent = pte_mk_savedwrite(ptent);\n" + "> \302\240\n" + "> \302\240\t\t\t/* Avoid taking write faults for known dirty pages */\n" + "> \302\240\t\t\tif (dirty_accountable && pte_dirty(ptent) &&\n" + "> \302\240\t\t\t\t\t(pte_soft_dirty(ptent) ||\n" + "> \302\240\t\t\t\t\t\302\240!(vma->vm_flags & VM_SOFTDIRTY))) {\n" + "> -\t\t\t\tptent = pte_mkwrite(ptent);\n" + "> +\t\t\t\tptent = pte_mk_savedwrite(ptent);\n" + "> \302\240\t\t\t}\n" + "> \302\240\t\t\tptep_modify_prot_commit(mm, addr, pte, ptent);\n" + "> \302\240\t\t\tpages++;\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>" -3506943762bdb7fcc042172297987322bd4e2e620234b8db64b81252d151a7bc +d9eb6cc0bd6ed7ad1729638993c2096c825b635e202f207617388bc19f870198
diff --git a/a/1.txt b/N2/1.txt index 90bd471..7a6e5d2 100644 --- a/a/1.txt +++ b/N2/1.txt @@ -1,18 +1,13 @@ On Thu, 2017-02-09 at 08:30 +0530, Aneesh Kumar K.V wrote: > Autonuma preserves the write permission across numa fault to avoid taking -> a writefault after a numa fault (Commit: b191f9b106ea " mm: numa: preserv= -e PTE -> write permissions across a NUMA hinting fault"). Architecture can impleme= -nt -> protnone in different ways and some may choose to implement that by clear= -ing +> a writefault after a numa fault (Commit: b191f9b106ea " mm: numa: preserve PTE +> write permissions across a NUMA hinting fault"). Architecture can implement +> protnone in different ways and some may choose to implement that by clearing > Read/ -> Write/Exec bit of pte. Setting the write bit on such pte can result in wr= -ong -> behaviour. Fix this up by allowing arch to override how to save the write= - bit +> Write/Exec bit of pte. Setting the write bit on such pte can result in wrong +> behaviour. Fix this up by allowing arch to override how to save the write bit > on a protnone pte. ->=20 +> > Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> FWIW this is pretty simple and helps with us in powerpc... @@ -20,27 +15,21 @@ FWIW this is pretty simple and helps with us in powerpc... Acked-By: Michael Neuling <mikey@neuling.org> > --- -> =C2=A0include/asm-generic/pgtable.h | 16 ++++++++++++++++ -> =C2=A0mm/huge_memory.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= -=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2=A04 ++-- -> =C2=A0mm/memory.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2=A02 = -+- -> =C2=A0mm/mprotect.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2=A04 ++-- -> =C2=A04 files changed, 21 insertions(+), 5 deletions(-) ->=20 -> diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.= -h +> include/asm-generic/pgtable.h | 16 ++++++++++++++++ +> mm/huge_memory.c | 4 ++-- +> mm/memory.c | 2 +- +> mm/mprotect.c | 4 ++-- +> 4 files changed, 21 insertions(+), 5 deletions(-) +> +> diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h > index 18af2bcefe6a..b6f3a8a4b738 100644 > --- a/include/asm-generic/pgtable.h > +++ b/include/asm-generic/pgtable.h -> @@ -192,6 +192,22 @@ static inline void ptep_set_wrprotect(struct mm_stru= -ct +> @@ -192,6 +192,22 @@ static inline void ptep_set_wrprotect(struct mm_struct > *mm, unsigned long addres -> =C2=A0} -> =C2=A0#endif -> =C2=A0 +> } +> #endif +> > +#ifndef pte_savedwrite > +#define pte_savedwrite pte_write > +#endif @@ -57,67 +46,65 @@ ct > +#define pmd_mk_savedwrite pmd_mkwrite > +#endif > + -> =C2=A0#ifndef __HAVE_ARCH_PMDP_SET_WRPROTECT -> =C2=A0#ifdef CONFIG_TRANSPARENT_HUGEPAGE -> =C2=A0static inline void pmdp_set_wrprotect(struct mm_struct *mm, +> #ifndef __HAVE_ARCH_PMDP_SET_WRPROTECT +> #ifdef CONFIG_TRANSPARENT_HUGEPAGE +> static inline void pmdp_set_wrprotect(struct mm_struct *mm, > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > index 9a6bd6c8d55a..2f0f855ec911 100644 > --- a/mm/huge_memory.c > +++ b/mm/huge_memory.c -> @@ -1300,7 +1300,7 @@ int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd= -_t +> @@ -1300,7 +1300,7 @@ int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t > pmd) -> =C2=A0 goto out; -> =C2=A0clear_pmdnuma: -> =C2=A0 BUG_ON(!PageLocked(page)); -> - was_writable =3D pmd_write(pmd); -> + was_writable =3D pmd_savedwrite(pmd); -> =C2=A0 pmd =3D pmd_modify(pmd, vma->vm_page_prot); -> =C2=A0 pmd =3D pmd_mkyoung(pmd); -> =C2=A0 if (was_writable) -> @@ -1555,7 +1555,7 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd= -_t +> goto out; +> clear_pmdnuma: +> BUG_ON(!PageLocked(page)); +> - was_writable = pmd_write(pmd); +> + was_writable = pmd_savedwrite(pmd); +> pmd = pmd_modify(pmd, vma->vm_page_prot); +> pmd = pmd_mkyoung(pmd); +> if (was_writable) +> @@ -1555,7 +1555,7 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd_t > *pmd, -> =C2=A0 entry =3D pmdp_huge_get_and_clear_notify(mm, addr, +> entry = pmdp_huge_get_and_clear_notify(mm, addr, > pmd); -> =C2=A0 entry =3D pmd_modify(entry, newprot); -> =C2=A0 if (preserve_write) -> - entry =3D pmd_mkwrite(entry); -> + entry =3D pmd_mk_savedwrite(entry); -> =C2=A0 ret =3D HPAGE_PMD_NR; -> =C2=A0 set_pmd_at(mm, addr, pmd, entry); -> =C2=A0 BUG_ON(vma_is_anonymous(vma) && !preserve_write && +> entry = pmd_modify(entry, newprot); +> if (preserve_write) +> - entry = pmd_mkwrite(entry); +> + entry = pmd_mk_savedwrite(entry); +> ret = HPAGE_PMD_NR; +> set_pmd_at(mm, addr, pmd, entry); +> BUG_ON(vma_is_anonymous(vma) && !preserve_write && > diff --git a/mm/memory.c b/mm/memory.c > index e78bf72f30dd..88c24f89d6d3 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -3388,7 +3388,7 @@ static int do_numa_page(struct vm_fault *vmf) -> =C2=A0 int target_nid; -> =C2=A0 bool migrated =3D false; -> =C2=A0 pte_t pte; -> - bool was_writable =3D pte_write(vmf->orig_pte); -> + bool was_writable =3D pte_savedwrite(vmf->orig_pte); -> =C2=A0 int flags =3D 0; -> =C2=A0 -> =C2=A0 /* +> int target_nid; +> bool migrated = false; +> pte_t pte; +> - bool was_writable = pte_write(vmf->orig_pte); +> + bool was_writable = pte_savedwrite(vmf->orig_pte); +> int flags = 0; +> +> /* > diff --git a/mm/mprotect.c b/mm/mprotect.c > index f9c07f54dd62..15f5c174a7c1 100644 > --- a/mm/mprotect.c > +++ b/mm/mprotect.c > @@ -113,13 +113,13 @@ static unsigned long change_pte_range(struct > vm_area_struct *vma, pmd_t *pmd, -> =C2=A0 ptent =3D ptep_modify_prot_start(mm, addr, pte); -> =C2=A0 ptent =3D pte_modify(ptent, newprot); -> =C2=A0 if (preserve_write) -> - ptent =3D pte_mkwrite(ptent); -> + ptent =3D pte_mk_savedwrite(ptent); -> =C2=A0 -> =C2=A0 /* Avoid taking write faults for known dirty pages */ -> =C2=A0 if (dirty_accountable && pte_dirty(ptent) && -> =C2=A0 (pte_soft_dirty(ptent) || -> =C2=A0 =C2=A0!(vma->vm_flags & VM_SOFTDIRTY))) { -> - ptent =3D pte_mkwrite(ptent); -> + ptent =3D pte_mk_savedwrite(ptent); -> =C2=A0 } -> =C2=A0 ptep_modify_prot_commit(mm, addr, pte, ptent); -> =C2=A0 pages++; +> ptent = ptep_modify_prot_start(mm, addr, pte); +> ptent = pte_modify(ptent, newprot); +> if (preserve_write) +> - ptent = pte_mkwrite(ptent); +> + ptent = pte_mk_savedwrite(ptent); +> +> /* Avoid taking write faults for known dirty pages */ +> if (dirty_accountable && pte_dirty(ptent) && +> (pte_soft_dirty(ptent) || +> !(vma->vm_flags & VM_SOFTDIRTY))) { +> - ptent = pte_mkwrite(ptent); +> + ptent = pte_mk_savedwrite(ptent); +> } +> ptep_modify_prot_commit(mm, addr, pte, ptent); +> pages++; diff --git a/a/content_digest b/N2/content_digest index 14e3aaf..43e022c 100644 --- a/a/content_digest +++ b/N2/content_digest @@ -15,19 +15,14 @@ "b\0" "On Thu, 2017-02-09 at 08:30 +0530, Aneesh Kumar K.V wrote:\n" "> Autonuma preserves the write permission across numa fault to avoid taking\n" - "> a writefault after a numa fault (Commit: b191f9b106ea \" mm: numa: preserv=\n" - "e PTE\n" - "> write permissions across a NUMA hinting fault\"). Architecture can impleme=\n" - "nt\n" - "> protnone in different ways and some may choose to implement that by clear=\n" - "ing\n" + "> a writefault after a numa fault (Commit: b191f9b106ea \" mm: numa: preserve PTE\n" + "> write permissions across a NUMA hinting fault\"). Architecture can implement\n" + "> protnone in different ways and some may choose to implement that by clearing\n" "> Read/\n" - "> Write/Exec bit of pte. Setting the write bit on such pte can result in wr=\n" - "ong\n" - "> behaviour. Fix this up by allowing arch to override how to save the write=\n" - " bit\n" + "> Write/Exec bit of pte. Setting the write bit on such pte can result in wrong\n" + "> behaviour. Fix this up by allowing arch to override how to save the write bit\n" "> on a protnone pte.\n" - ">=20\n" + "> \n" "> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>\n" "\n" "FWIW this is pretty simple and helps with us in powerpc...\n" @@ -35,27 +30,21 @@ "Acked-By: Michael Neuling <mikey@neuling.org>\n" "\n" "> ---\n" - "> =C2=A0include/asm-generic/pgtable.h | 16 ++++++++++++++++\n" - "> =C2=A0mm/huge_memory.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=\n" - "=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2=A04 ++--\n" - "> =C2=A0mm/memory.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=\n" - "=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2=A02 =\n" - "+-\n" - "> =C2=A0mm/mprotect.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=\n" - "=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0|=C2=A0=C2=A04 ++--\n" - "> =C2=A04 files changed, 21 insertions(+), 5 deletions(-)\n" - ">=20\n" - "> diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.=\n" - "h\n" + "> \302\240include/asm-generic/pgtable.h | 16 ++++++++++++++++\n" + "> \302\240mm/huge_memory.c\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240|\302\240\302\2404 ++--\n" + "> \302\240mm/memory.c\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240|\302\240\302\2402 +-\n" + "> \302\240mm/mprotect.c\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240|\302\240\302\2404 ++--\n" + "> \302\2404 files changed, 21 insertions(+), 5 deletions(-)\n" + "> \n" + "> diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h\n" "> index 18af2bcefe6a..b6f3a8a4b738 100644\n" "> --- a/include/asm-generic/pgtable.h\n" "> +++ b/include/asm-generic/pgtable.h\n" - "> @@ -192,6 +192,22 @@ static inline void ptep_set_wrprotect(struct mm_stru=\n" - "ct\n" + "> @@ -192,6 +192,22 @@ static inline void ptep_set_wrprotect(struct mm_struct\n" "> *mm, unsigned long addres\n" - "> =C2=A0}\n" - "> =C2=A0#endif\n" - "> =C2=A0\n" + "> \302\240}\n" + "> \302\240#endif\n" + "> \302\240\n" "> +#ifndef pte_savedwrite\n" "> +#define pte_savedwrite pte_write\n" "> +#endif\n" @@ -72,69 +61,67 @@ "> +#define pmd_mk_savedwrite pmd_mkwrite\n" "> +#endif\n" "> +\n" - "> =C2=A0#ifndef __HAVE_ARCH_PMDP_SET_WRPROTECT\n" - "> =C2=A0#ifdef CONFIG_TRANSPARENT_HUGEPAGE\n" - "> =C2=A0static inline void pmdp_set_wrprotect(struct mm_struct *mm,\n" + "> \302\240#ifndef __HAVE_ARCH_PMDP_SET_WRPROTECT\n" + "> \302\240#ifdef CONFIG_TRANSPARENT_HUGEPAGE\n" + "> \302\240static inline void pmdp_set_wrprotect(struct mm_struct *mm,\n" "> diff --git a/mm/huge_memory.c b/mm/huge_memory.c\n" "> index 9a6bd6c8d55a..2f0f855ec911 100644\n" "> --- a/mm/huge_memory.c\n" "> +++ b/mm/huge_memory.c\n" - "> @@ -1300,7 +1300,7 @@ int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd=\n" - "_t\n" + "> @@ -1300,7 +1300,7 @@ int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t\n" "> pmd)\n" - "> =C2=A0\tgoto out;\n" - "> =C2=A0clear_pmdnuma:\n" - "> =C2=A0\tBUG_ON(!PageLocked(page));\n" - "> -\twas_writable =3D pmd_write(pmd);\n" - "> +\twas_writable =3D pmd_savedwrite(pmd);\n" - "> =C2=A0\tpmd =3D pmd_modify(pmd, vma->vm_page_prot);\n" - "> =C2=A0\tpmd =3D pmd_mkyoung(pmd);\n" - "> =C2=A0\tif (was_writable)\n" - "> @@ -1555,7 +1555,7 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd=\n" - "_t\n" + "> \302\240\tgoto out;\n" + "> \302\240clear_pmdnuma:\n" + "> \302\240\tBUG_ON(!PageLocked(page));\n" + "> -\twas_writable = pmd_write(pmd);\n" + "> +\twas_writable = pmd_savedwrite(pmd);\n" + "> \302\240\tpmd = pmd_modify(pmd, vma->vm_page_prot);\n" + "> \302\240\tpmd = pmd_mkyoung(pmd);\n" + "> \302\240\tif (was_writable)\n" + "> @@ -1555,7 +1555,7 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd_t\n" "> *pmd,\n" - "> =C2=A0\t\t\tentry =3D pmdp_huge_get_and_clear_notify(mm, addr,\n" + "> \302\240\t\t\tentry = pmdp_huge_get_and_clear_notify(mm, addr,\n" "> pmd);\n" - "> =C2=A0\t\t\tentry =3D pmd_modify(entry, newprot);\n" - "> =C2=A0\t\t\tif (preserve_write)\n" - "> -\t\t\t\tentry =3D pmd_mkwrite(entry);\n" - "> +\t\t\t\tentry =3D pmd_mk_savedwrite(entry);\n" - "> =C2=A0\t\t\tret =3D HPAGE_PMD_NR;\n" - "> =C2=A0\t\t\tset_pmd_at(mm, addr, pmd, entry);\n" - "> =C2=A0\t\t\tBUG_ON(vma_is_anonymous(vma) && !preserve_write &&\n" + "> \302\240\t\t\tentry = pmd_modify(entry, newprot);\n" + "> \302\240\t\t\tif (preserve_write)\n" + "> -\t\t\t\tentry = pmd_mkwrite(entry);\n" + "> +\t\t\t\tentry = pmd_mk_savedwrite(entry);\n" + "> \302\240\t\t\tret = HPAGE_PMD_NR;\n" + "> \302\240\t\t\tset_pmd_at(mm, addr, pmd, entry);\n" + "> \302\240\t\t\tBUG_ON(vma_is_anonymous(vma) && !preserve_write &&\n" "> diff --git a/mm/memory.c b/mm/memory.c\n" "> index e78bf72f30dd..88c24f89d6d3 100644\n" "> --- a/mm/memory.c\n" "> +++ b/mm/memory.c\n" "> @@ -3388,7 +3388,7 @@ static int do_numa_page(struct vm_fault *vmf)\n" - "> =C2=A0\tint target_nid;\n" - "> =C2=A0\tbool migrated =3D false;\n" - "> =C2=A0\tpte_t pte;\n" - "> -\tbool was_writable =3D pte_write(vmf->orig_pte);\n" - "> +\tbool was_writable =3D pte_savedwrite(vmf->orig_pte);\n" - "> =C2=A0\tint flags =3D 0;\n" - "> =C2=A0\n" - "> =C2=A0\t/*\n" + "> \302\240\tint target_nid;\n" + "> \302\240\tbool migrated = false;\n" + "> \302\240\tpte_t pte;\n" + "> -\tbool was_writable = pte_write(vmf->orig_pte);\n" + "> +\tbool was_writable = pte_savedwrite(vmf->orig_pte);\n" + "> \302\240\tint flags = 0;\n" + "> \302\240\n" + "> \302\240\t/*\n" "> diff --git a/mm/mprotect.c b/mm/mprotect.c\n" "> index f9c07f54dd62..15f5c174a7c1 100644\n" "> --- a/mm/mprotect.c\n" "> +++ b/mm/mprotect.c\n" "> @@ -113,13 +113,13 @@ static unsigned long change_pte_range(struct\n" "> vm_area_struct *vma, pmd_t *pmd,\n" - "> =C2=A0\t\t\tptent =3D ptep_modify_prot_start(mm, addr, pte);\n" - "> =C2=A0\t\t\tptent =3D pte_modify(ptent, newprot);\n" - "> =C2=A0\t\t\tif (preserve_write)\n" - "> -\t\t\t\tptent =3D pte_mkwrite(ptent);\n" - "> +\t\t\t\tptent =3D pte_mk_savedwrite(ptent);\n" - "> =C2=A0\n" - "> =C2=A0\t\t\t/* Avoid taking write faults for known dirty pages */\n" - "> =C2=A0\t\t\tif (dirty_accountable && pte_dirty(ptent) &&\n" - "> =C2=A0\t\t\t\t\t(pte_soft_dirty(ptent) ||\n" - "> =C2=A0\t\t\t\t\t=C2=A0!(vma->vm_flags & VM_SOFTDIRTY))) {\n" - "> -\t\t\t\tptent =3D pte_mkwrite(ptent);\n" - "> +\t\t\t\tptent =3D pte_mk_savedwrite(ptent);\n" - "> =C2=A0\t\t\t}\n" - "> =C2=A0\t\t\tptep_modify_prot_commit(mm, addr, pte, ptent);\n" - "> =C2=A0\t\t\tpages++;" + "> \302\240\t\t\tptent = ptep_modify_prot_start(mm, addr, pte);\n" + "> \302\240\t\t\tptent = pte_modify(ptent, newprot);\n" + "> \302\240\t\t\tif (preserve_write)\n" + "> -\t\t\t\tptent = pte_mkwrite(ptent);\n" + "> +\t\t\t\tptent = pte_mk_savedwrite(ptent);\n" + "> \302\240\n" + "> \302\240\t\t\t/* Avoid taking write faults for known dirty pages */\n" + "> \302\240\t\t\tif (dirty_accountable && pte_dirty(ptent) &&\n" + "> \302\240\t\t\t\t\t(pte_soft_dirty(ptent) ||\n" + "> \302\240\t\t\t\t\t\302\240!(vma->vm_flags & VM_SOFTDIRTY))) {\n" + "> -\t\t\t\tptent = pte_mkwrite(ptent);\n" + "> +\t\t\t\tptent = pte_mk_savedwrite(ptent);\n" + "> \302\240\t\t\t}\n" + "> \302\240\t\t\tptep_modify_prot_commit(mm, addr, pte, ptent);\n" + "> \302\240\t\t\tpages++;" -3506943762bdb7fcc042172297987322bd4e2e620234b8db64b81252d151a7bc +93547a6b5f2a84164d6ed91e6d7676b3fb0aae60d89ac6212325518c52ad8f28
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.