mm/THP: Use the right function when updating access flags
Subsystems (2)
PATCH 1/1 mm/THP: Use the right function when updating access flags
From: "Aneesh Kumar K.V" <[email protected]>
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.
--- mm/huge_memory.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
mm/huge_memory.c +3 -1
@@ -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)) {
Signature · 7 lines
1.8.1.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Andrew Morton
maintainerQuoted 11 lines · On Tue, 7 May 2013 02:19:48 +0530 "Aneesh Kumar K.V"…
From: "Aneesh Kumar K.V" <[email protected]>
We should use
pmdp_set_access_flagsto update access flags. Archs like powerpc use extrachecks(_PAGE_BUSY)when updating a hugepage PTE. Aset_pmd_atdoesn't do those checks. We should useset_pmd_atonly when updating a none hugepage PTE....
mm/huge_memory.c struct page *follow_trans_huge_pmd(struct vm_area_struct *vma, · line 1273
Quoted 10 lines
mm/huge_memory.c +3
-1@@ -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)) {
<canned message>
When writing a changelog, please describe the end-user-visible effects of the bug, so that others can more easily decide which kernel version(s) should be fixed, and so that downstream kernel maintainers can more easily work out whether this patch will fix a problem which they or their customers are observing.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 22 lines · Andrew Morton
Quoted 20 lines · On Tue, 7 May 2013 02:19:48 +0530 "Aneesh Kumar K.V"…
From: "Aneesh Kumar K.V" <[email protected]>
We should use
pmdp_set_access_flagsto update access flags. Archs like powerpc use extrachecks(_PAGE_BUSY)when updating a hugepage PTE. Aset_pmd_atdoesn't do those checks. We should useset_pmd_atonly when updating a none hugepage PTE....
mm/huge_memory.c +3
-1@@ -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 )) {
Quoted 8 lines
mm/huge_memory.c struct page *follow_trans_huge_pmd(struct vm_area_struct *vma, · line 1273
Quoted 1 line
mm/huge_memory.c +0
-0if (page->mapping &&trylock_page (page)) {<canned message>
When writing a changelog, please describe the end-user-visible effects of the bug, so that others can more easily decide which kernel version(s) should be fixed, and so that downstream kernel maintainers can more easily work out whether this patch will fix a problem which they or their customers are observing.
I found that reading code while debugging some crashes with THP on ppc64. So user visible effects would mostly be some random crashes. I will make sure to document the user visible effects next time.
-aneesh
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>