Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1566820
| From | "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCHv2 04/12] mm: fix handling PTE-mapped THPs in page_idle_clear_pte_refs() |
| Date | 2017-01-25 19:30 +0100 |
| Message-ID | <t3Auv-5et-35@gated-at.bofh.it> (permalink) |
| References | <t3Auu-5et-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
For PTE-mapped THP page_check_address_transhuge() is not adequate: it
cannot find all relevant PTEs, only the first one.i
Let's switch it to page_vma_mapped_walk().
I don't think it's subject for stable@: it's not fatal.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
---
mm/page_idle.c | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/mm/page_idle.c b/mm/page_idle.c
index ae11aa914e55..b0ee56c56b58 100644
--- a/mm/page_idle.c
+++ b/mm/page_idle.c
@@ -54,27 +54,27 @@ static int page_idle_clear_pte_refs_one(struct page *page,
struct vm_area_struct *vma,
unsigned long addr, void *arg)
{
- struct mm_struct *mm = vma->vm_mm;
- pmd_t *pmd;
- pte_t *pte;
- spinlock_t *ptl;
+ struct page_vma_mapped_walk pvmw = {
+ .page = page,
+ .vma = vma,
+ .address = addr,
+ };
bool referenced = false;
- if (!page_check_address_transhuge(page, mm, addr, &pmd, &pte, &ptl))
- return SWAP_AGAIN;
-
- if (pte) {
- referenced = ptep_clear_young_notify(vma, addr, pte);
- pte_unmap(pte);
- } else if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
- referenced = pmdp_clear_young_notify(vma, addr, pmd);
- } else {
- /* unexpected pmd-mapped page? */
- WARN_ON_ONCE(1);
+ while (page_vma_mapped_walk(&pvmw)) {
+ addr = pvmw.address;
+ if (pvmw.pte) {
+ referenced = ptep_clear_young_notify(vma, addr,
+ pvmw.pte);
+ } else if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
+ referenced = pmdp_clear_young_notify(vma, addr,
+ pvmw.pmd);
+ } else {
+ /* unexpected pmd-mapped page? */
+ WARN_ON_ONCE(1);
+ }
}
- spin_unlock(ptl);
-
if (referenced) {
clear_page_idle(page);
/*
--
2.11.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCHv2 00/12] Fix few rmap-related THP bugs "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-01-25 19:30 +0100
[PATCHv2 04/12] mm: fix handling PTE-mapped THPs in page_idle_clear_pte_refs() "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-01-25 19:30 +0100
[PATCHv2 08/12] mm, ksm: convert write_protect_page() to page_vma_mapped_walk() "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-01-25 19:30 +0100
[PATCHv2 11/12] mm: drop page_check_address{,_transhuge} "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-01-25 19:30 +0100
[PATCHv2 10/12] mm: convert page_mapped_in_vma() to page_vma_mapped_walk() "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-01-25 19:30 +0100
Re: [PATCHv2 10/12] mm: convert page_mapped_in_vma() to page_vma_mapped_walk() "Hillf Danton" <hillf.zj@alibaba-inc.com> - 2017-01-26 08:40 +0100
[PATCHv2 07/12] mm: convert try_to_unmap_one() to page_vma_mapped_walk() "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-01-25 19:30 +0100
Re: [PATCHv2 07/12] mm: convert try_to_unmap_one() to page_vma_mapped_walk() kbuild test robot <lkp@intel.com> - 2017-01-25 20:10 +0100
Re: [PATCHv2 07/12] mm: convert try_to_unmap_one() to page_vma_mapped_walk() kbuild test robot <lkp@intel.com> - 2017-01-25 20:10 +0100
Re: [PATCHv2 07/12] mm: convert try_to_unmap_one() to page_vma_mapped_walk() "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-01-25 23:50 +0100
[PATCHv2 06/12] mm: convert page_mkclean_one() to page_vma_mapped_walk() "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-01-25 19:30 +0100
[PATCHv2 12/12] mm: convert remove_migration_pte() to page_vma_mapped_walk() "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-01-25 19:30 +0100
[PATCHv2 02/12] mm: introduce page_vma_mapped_walk() "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-01-25 19:30 +0100
Re: [PATCHv2 02/12] mm: introduce page_vma_mapped_walk() "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-01-25 21:40 +0100
Re: [PATCHv2 02/12] mm: introduce page_vma_mapped_walk() "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-01-25 23:50 +0100
csiph-web