Commit e72e784f authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'mm-hotfixes-stable-2025-05-17-09-41' of...

Merge tag 'mm-hotfixes-stable-2025-05-17-09-41' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Pull hotfixes from Andrew Morton:
 "Nine singleton hotfixes, all MM.  Four are cc:stable"

* tag 'mm-hotfixes-stable-2025-05-17-09-41' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
  mm: userfaultfd: correct dirty flags set for both present and swap pte
  zsmalloc: don't underflow size calculation in zs_obj_write()
  mm/page_alloc: fix race condition in unaccepted memory handling
  mm/page_alloc: ensure try_alloc_pages() plays well with unaccepted memory
  MAINTAINERS: add mm GUP section
  mm/codetag: move tag retrieval back upfront in __free_pages()
  mm/memory: fix mapcount / refcount sanity check for mTHP reuse
  kernel/fork: only call untrack_pfn_clear() on VMAs duplicated for fork()
  mm: hugetlb: fix incorrect fallback for subpool
parents 205b2bd7 75cb1cca
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -15549,6 +15549,18 @@ S: Maintained
F:	include/linux/execmem.h
F:	mm/execmem.c
MEMORY MANAGEMENT - GUP (GET USER PAGES)
M:	Andrew Morton <akpm@linux-foundation.org>
M:	David Hildenbrand <david@redhat.com>
R:	Jason Gunthorpe <jgg@nvidia.com>
R:	John Hubbard <jhubbard@nvidia.com>
R:	Peter Xu <peterx@redhat.com>
L:	linux-mm@kvack.org
S:	Maintained
W:	http://www.linux-mm.org
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
F:	mm/gup.c
MEMORY MANAGEMENT - NUMA MEMBLOCKS AND NUMA EMULATION
M:	Andrew Morton <akpm@linux-foundation.org>
M:	Mike Rapoport <rppt@kernel.org>
+8 −0
Original line number Diff line number Diff line
@@ -188,6 +188,13 @@ static inline struct alloc_tag *__pgalloc_tag_get(struct page *page)
	return tag;
}

static inline struct alloc_tag *pgalloc_tag_get(struct page *page)
{
	if (mem_alloc_profiling_enabled())
		return __pgalloc_tag_get(page);
	return NULL;
}

void pgalloc_tag_split(struct folio *folio, int old_order, int new_order);
void pgalloc_tag_swap(struct folio *new, struct folio *old);

@@ -199,6 +206,7 @@ static inline void clear_page_tag_ref(struct page *page) {}
static inline void alloc_tag_sec_init(void) {}
static inline void pgalloc_tag_split(struct folio *folio, int old_order, int new_order) {}
static inline void pgalloc_tag_swap(struct folio *new, struct folio *old) {}
static inline struct alloc_tag *pgalloc_tag_get(struct page *page) { return NULL; }

#endif /* CONFIG_MEM_ALLOC_PROFILING */

+5 −4
Original line number Diff line number Diff line
@@ -498,10 +498,6 @@ struct vm_area_struct *vm_area_dup(struct vm_area_struct *orig)
	vma_numab_state_init(new);
	dup_anon_vma_name(orig, new);

	/* track_pfn_copy() will later take care of copying internal state. */
	if (unlikely(new->vm_flags & VM_PFNMAP))
		untrack_pfn_clear(new);

	return new;
}

@@ -672,6 +668,11 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm,
		tmp = vm_area_dup(mpnt);
		if (!tmp)
			goto fail_nomem;

		/* track_pfn_copy() will later take care of copying internal state. */
		if (unlikely(tmp->vm_flags & VM_PFNMAP))
			untrack_pfn_clear(tmp);

		retval = vma_dup_policy(mpnt, tmp);
		if (retval)
			goto fail_nomem_policy;
+22 −6
Original line number Diff line number Diff line
@@ -3010,7 +3010,7 @@ struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma,
	struct hugepage_subpool *spool = subpool_vma(vma);
	struct hstate *h = hstate_vma(vma);
	struct folio *folio;
	long retval, gbl_chg;
	long retval, gbl_chg, gbl_reserve;
	map_chg_state map_chg;
	int ret, idx;
	struct hugetlb_cgroup *h_cg = NULL;
@@ -3163,8 +3163,16 @@ struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma,
		hugetlb_cgroup_uncharge_cgroup_rsvd(idx, pages_per_huge_page(h),
						    h_cg);
out_subpool_put:
	if (map_chg)
		hugepage_subpool_put_pages(spool, 1);
	/*
	 * put page to subpool iff the quota of subpool's rsv_hpages is used
	 * during hugepage_subpool_get_pages.
	 */
	if (map_chg && !gbl_chg) {
		gbl_reserve = hugepage_subpool_put_pages(spool, 1);
		hugetlb_acct_memory(h, -gbl_reserve);
	}


out_end_reservation:
	if (map_chg != MAP_CHG_ENFORCED)
		vma_end_reservation(h, vma, addr);
@@ -7239,7 +7247,7 @@ bool hugetlb_reserve_pages(struct inode *inode,
					struct vm_area_struct *vma,
					vm_flags_t vm_flags)
{
	long chg = -1, add = -1;
	long chg = -1, add = -1, spool_resv, gbl_resv;
	struct hstate *h = hstate_inode(inode);
	struct hugepage_subpool *spool = subpool_inode(inode);
	struct resv_map *resv_map;
@@ -7374,8 +7382,16 @@ bool hugetlb_reserve_pages(struct inode *inode,
	return true;

out_put_pages:
	/* put back original number of pages, chg */
	(void)hugepage_subpool_put_pages(spool, chg);
	spool_resv = chg - gbl_reserve;
	if (spool_resv) {
		/* put sub pool's reservation back, chg - gbl_reserve */
		gbl_resv = hugepage_subpool_put_pages(spool, spool_resv);
		/*
		 * subpool's reserved pages can not be put back due to race,
		 * return to hstate.
		 */
		hugetlb_acct_memory(h, -gbl_resv);
	}
out_uncharge_cgroup:
	hugetlb_cgroup_uncharge_cgroup_rsvd(hstate_index(h),
					    chg * pages_per_huge_page(h), h_cg);
+0 −1
Original line number Diff line number Diff line
@@ -1590,7 +1590,6 @@ unsigned long move_page_tables(struct pagetable_move_control *pmc);

#ifdef CONFIG_UNACCEPTED_MEMORY
void accept_page(struct page *page);
void unaccepted_cleanup_work(struct work_struct *work);
#else /* CONFIG_UNACCEPTED_MEMORY */
static inline void accept_page(struct page *page)
{
Loading