mm-pvmw-check-possible-huge-pmd-map-by-transhuge_vma_suitable.patch removed from -mm tree
The quilt patch titled
Subject: mm/page_vma_mapped.c: check possible huge PMD map with transhuge_vma_suitable()
has been removed from the -mm tree. Its filename was
mm-pvmw-check-possible-huge-pmd-map-by-transhuge_vma_suitable.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Yang Shi <[email protected]>
Subject: mm/page_vma_mapped.c: check possible huge PMD map with transhuge_vma_suitable()
Date: Fri, 13 May 2022 12:17:05 -0700
IIUC page_vma_mapped_walk() checks if the vma is possibly huge PMD mapped with transparent_hugepage_active() and "pvmw->nr_pages >= HPAGE_PMD_NR".
Actually pvmw->nr_pages is returned by compound_nr() or folio_nr_pages(), so the page should be THP as long as "pvmw->nr_pages >= HPAGE_PMD_NR". And it is guaranteed THP is allocated for valid VMA in the first place. But it may be not PMD mapped if the VMA is file VMA and it is not properly aligned. The transhuge_vma_suitable() is used to do such check, so replace transparent_hugepage_active() to it, which is too heavy and overkilling.
---
include/linux/huge_mm.h | 8 ++++++-- mm/page_vma_mapped.c | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-)
include/linux/huge_mm.h renamed from include/linux/huge_mm.h~mm-pvmw-check-possible-huge-pmd-map-by-transhuge_vma_suitable +6 -2
@@ -117,8 +117,10 @@ extern struct kobj_attribute shmem_enablextern unsigned long transparent_hugepage_flags; static inline bool transhuge_vma_suitable(struct vm_area_struct *vma, - unsigned long haddr) + unsigned long addr) { + unsigned long haddr; + /* Don't have to check pgoff for anonymous vma */ if (!vma_is_anonymous(vma)) { if (!IS_ALIGNED((vma->vm_start >> PAGE_SHIFT) - vma->vm_pgoff,
@@ -126,6 +128,8 @@ static inline bool transhuge_vma_suitablreturn false; } + haddr = addr &HPAGE_PMD_MASK ; +if (haddr < vma->vm_start || haddr +HPAGE_PMD_SIZE > vma->vm_end)return false;return true;
@@ -342,7 +346,7 @@ static inline bool transparent_hugepage_ }static inline bool transhuge_vma_suitable (struct vm_area_struct *vma, -unsigned long haddr) +unsigned long addr) {return false; }
mm/page_vma_mapped.c renamed from mm/page_vma_mapped.c~mm-pvmw-check-possible-huge-pmd-map-by-transhuge_vma_suitable +1 -1
@@ -243,7 +243,7 @@ restart:* cleared *pmd but not decremented compound_mapcount(). */ if ((pvmw->flags &PVMW_SYNC ) && -transparent_hugepage_active (vma) && +transhuge_vma_suitable (vma, pvmw->address) && (pvmw->nr_pages >=HPAGE_PMD_NR )) {spinlock_t *ptl =pmd_lock (mm, pvmw->pmd);
_
Patches currently in -mm which might be from [email protected] are
mm-khugepaged-check-thp-flag-in-hugepage_vma_check.patch mm-thp-consolidate-vma-size-check-to-transhuge_vma_suitable.patch mm-khugepaged-better-comments-for-anon-vma-check-in-hugepage_vma_revalidate.patch mm-thp-kill-transparent_hugepage_active.patch mm-thp-kill-__transhuge_page_enabled.patch mm-khugepaged-reorg-some-khugepaged-helpers.patch doc-proc-fix-the-description-to-thpeligible.patch