From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org, jannh@google.com
Cc: Sasha Levin <sashal@kernel.org>
Subject: Re: [PATCH 6.6.y] mm/hugetlb: unshare page tables during VMA split, not before
Date: Sat, 21 Jun 2025 06:15:20 -0400 [thread overview]
Message-ID: <20250621052841-2e82f10b66fe127f@stable.kernel.org> (raw)
In-Reply-To: <20250620213127.157399-1-jannh@google.com>
[ 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 |
next prev parent reply other threads:[~2025-06-21 10:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-20 10:36 FAILED: patch "[PATCH] mm/hugetlb: unshare page tables during VMA split, not before" failed to apply to 6.6-stable tree gregkh
2025-06-20 21:31 ` [PATCH 6.6.y] mm/hugetlb: unshare page tables during VMA split, not before Jann Horn
2025-06-21 10:15 ` Sasha Levin [this message]
2025-06-24 17:07 ` Jann Horn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250621052841-2e82f10b66fe127f@stable.kernel.org \
--to=sashal@kernel.org \
--cc=jannh@google.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox