[ Sasha's backport helper bot ]
Hi,
Summary of potential issues: ⚠️ Found matching upstream commit but patch is missing proper reference to it
Found matching upstream commit: 081056dc00a27bccb55ccc3c6f230a3d5fd3f7e0
Status in newer kernel trees: 6.15.y | Present (different SHA1: 4391f7f0f242) 6.12.y | Not found
Note: The patch differs from the upstream commit: --- 1: 081056dc00a27 ! 1: e8ec25e3d047b mm/hugetlb: unshare page tables during VMA split, not before @@ Commit message Cc: stable@vger.kernel.org [b30c14cd6102: hugetlb: unshare some PMDs when splitting VMAs] Cc: stable@vger.kernel.org Signed-off-by: Andrew Morton akpm@linux-foundation.org + [stable backport: code got moved from mmap.c to vma.c] + Signed-off-by: Jann Horn jannh@google.com
## include/linux/hugetlb.h ## -@@ include/linux/hugetlb.h: bool is_hugetlb_entry_migration(pte_t pte); - bool is_hugetlb_entry_hwpoisoned(pte_t pte); +@@ include/linux/hugetlb.h: long hugetlb_change_protection(struct vm_area_struct *vma, + + bool is_hugetlb_entry_migration(pte_t pte); void hugetlb_unshare_all_pmds(struct vm_area_struct *vma); - void fixup_hugetlb_reservations(struct vm_area_struct *vma); +void hugetlb_split(struct vm_area_struct *vma, unsigned long addr);
#else /* !CONFIG_HUGETLB_PAGE */
-@@ include/linux/hugetlb.h: static inline void fixup_hugetlb_reservations(struct vm_area_struct *vma) - { - } +@@ include/linux/hugetlb.h: static inline vm_fault_t hugetlb_fault(struct mm_struct *mm, + + static inline void hugetlb_unshare_all_pmds(struct vm_area_struct *vma) { }
+static inline void hugetlb_split(struct vm_area_struct *vma, unsigned long addr) {} + #endif /* !CONFIG_HUGETLB_PAGE */ - - #ifndef pgd_write + /* + * hugepages at page global directory. If arch support
## mm/hugetlb.c ## @@ mm/hugetlb.c: static void hugetlb_vma_lock_free(struct vm_area_struct *vma); @@ mm/hugetlb.c: static void hugetlb_vma_lock_free(struct vm_area_struct *vma); + unsigned long start, unsigned long end, bool take_locks); static struct resv_map *vma_resv_map(struct vm_area_struct *vma);
- static void hugetlb_free_folio(struct folio *folio) + static inline bool subpool_is_free(struct hugepage_subpool *spool) @@ mm/hugetlb.c: static int hugetlb_vm_op_split(struct vm_area_struct *vma, unsigned long addr) { if (addr & ~(huge_page_mask(hstate_vma(vma)))) @@ mm/hugetlb.c: static int hugetlb_vm_op_split(struct vm_area_struct *vma, unsigne
static unsigned long hugetlb_vm_op_pagesize(struct vm_area_struct *vma) @@ mm/hugetlb.c: void move_hugetlb_state(struct folio *old_folio, struct folio *new_folio, int re - spin_unlock_irq(&hugetlb_lock); + } }
+/* @@ mm/hugetlb.c: static void hugetlb_unshare_pmds(struct vm_area_struct *vma, + /* take_locks = */ true); }
- /* + #ifdef CONFIG_CMA
- ## mm/vma.c ## -@@ mm/vma.c: __split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma, + ## mm/mmap.c ## +@@ mm/mmap.c: int __split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma, init_vma_prep(&vp, vma); vp.insert = new; vma_prepare(&vp); -+ + /* + * Get rid of huge pages and shared page tables straddling the split + * boundary. + */ - vma_adjust_trans_huge(vma, vma->vm_start, addr, NULL); + vma_adjust_trans_huge(vma, vma->vm_start, addr, 0); + if (is_vm_hugetlb_page(vma)) + hugetlb_split(vma, addr);
if (new_below) { vma->vm_start = addr; - - ## tools/testing/vma/vma_internal.h ## -@@ tools/testing/vma/vma_internal.h: static inline void vma_adjust_trans_huge(struct vm_area_struct *vma, - (void)next; - } - -+static inline void hugetlb_split(struct vm_area_struct *, unsigned long) {} -+ - static inline void vma_iter_free(struct vma_iterator *vmi) - { - mas_destroy(&vmi->mas); ---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-6.6.y | Success | Success |