The quilt patch titled Subject: mm: decline to manipulate the refcount on a slab page has been removed from the -mm tree. Its filename was mm-decline-to-manipulate-the-refcount-on-a-slab-page.patch This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm ------------------------------------------------------ From: "Matthew Wilcox (Oracle)" <willy@xxxxxxxxxxxxx> Subject: mm: decline to manipulate the refcount on a slab page Date: Mon, 10 Mar 2025 14:35:24 +0000 Slab pages now have a refcount of 0, so nobody should be trying to manipulate the refcount on them. Doing so has little effect; the object could be freed and reallocated to a different purpose, although the slab itself would not be until the refcount was put making it behave rather like TYPESAFE_BY_RCU. Unfortunately, __iov_iter_get_pages_alloc() does take a refcount. Fix that to not change the refcount, and make put_page() silently not change the refcount. get_page() warns so that we can fix any other callers that need to be changed. Long-term, networking needs to stop taking a refcount on the pages that it uses and rely on the caller to hold whatever references are necessary to make the memory stable. In the medium term, more page types are going to hav a zero refcount, so we'll want to move get_page() and put_page() out of line. Link: https://lkml.kernel.org/r/20250310143544.1216127-1-willy@xxxxxxxxxxxxx Fixes: 9aec2fb0fd5e (slab: allocate frozen pages) Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> Reported-by: Hannes Reinecke <hare@xxxxxxx> Closes: https://lore.kernel.org/all/08c29e4b-2f71-4b6d-8046-27e407214d8c@xxxxxxxx/ Acked-by: Vlastimil Babka <vbabka@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/mm.h | 8 +++++++- lib/iov_iter.c | 8 ++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) --- a/include/linux/mm.h~mm-decline-to-manipulate-the-refcount-on-a-slab-page +++ a/include/linux/mm.h @@ -1458,7 +1458,10 @@ static inline void folio_get(struct foli static inline void get_page(struct page *page) { - folio_get(page_folio(page)); + struct folio *folio = page_folio(page); + if (WARN_ON_ONCE(folio_test_slab(folio))) + return; + folio_get(folio); } static inline __must_check bool try_get_page(struct page *page) @@ -1552,6 +1555,9 @@ static inline void put_page(struct page { struct folio *folio = page_folio(page); + if (folio_test_slab(folio)) + return; + /* * For some devmap managed pages we need to catch refcount transition * from 2 to 1: --- a/lib/iov_iter.c~mm-decline-to-manipulate-the-refcount-on-a-slab-page +++ a/lib/iov_iter.c @@ -1190,8 +1190,12 @@ static ssize_t __iov_iter_get_pages_allo if (!n) return -ENOMEM; p = *pages; - for (int k = 0; k < n; k++) - get_page(p[k] = page + k); + for (int k = 0; k < n; k++) { + struct folio *folio = page_folio(page); + p[k] = page + k; + if (!folio_test_slab(folio)) + folio_get(folio); + } maxsize = min_t(size_t, maxsize, n * PAGE_SIZE - *start); i->count -= maxsize; i->iov_offset += maxsize; _ Patches currently in -mm which might be from willy@xxxxxxxxxxxxx are dax-remove-access-to-page-index.patch dax-use-folios-more-widely-within-dax.patch fs-convert-block_commit_write-to-take-a-folio.patch fs-remove-page_file_mapping.patch fs-remove-folio_file_mapping.patch mm-assert-the-folio-is-locked-in-folio_start_writeback.patch hugetlb-convert-hugetlb_vma_maps_page-to-hugetlb_vma_maps_pfn.patch hugetlb-convert-adjust_range_hwpoison-to-take-a-folio.patch mm-convert-lru_add_page_tail-to-lru_add_split_folio.patch mm-separate-folio_split_memcg_refs-from-split_page_memcg.patch mm-simplify-split_page_memcg.patch mm-remove-references-to-folio-in-split_page_memcg.patch mm-simplify-folio_memcg_charged.patch mm-remove-references-to-folio-in-__memcg_kmem_uncharge_page.patch ocfs2-use-memcpy_to_folio-in-ocfs2_symlink_get_block.patch ocfs2-remove-reference-to-bh-b_page.patch