Skip to contentSkip to conversation

mm-page_io-use-sio-len-for-pswpin-accounting-in-sio_read_complete.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Apr 18

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled

     Subject: mm/page_io: use sio->len for PSWPIN accounting in sio_read_complete()

has been removed from the -mm tree. Its filename was
mm-page_io-use-sio-len-for-pswpin-accounting-in-sio_read_complete.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: David Carlier <[email protected]>
Subject: mm/page_io: use sio->len for PSWPIN accounting in sio_read_complete()
Date: Thu, 2 Apr 2026 07:14:07 +0100

sio_read_complete() uses sio->pages to account global PSWPIN vm events, but sio->pages tracks the number of bvec entries (folios), not base pages.

While large folios cannot currently reach this path (SWP_FS_OPS and SWP_SYNCHRONOUS_IO are mutually exclusive, and mTHP swap-in allocation is gated on SWP_SYNCHRONOUS_IO), the accounting is semantically inconsistent with the per-memcg path which correctly uses folio_nr_pages().

Use sio->len >> PAGE_SHIFT instead, which gives the correct base page count since sio->len is accumulated via folio_size(folio).

---

 mm/page_io.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/page_io.c renamed from mm/page_io.c~mm-page_io-use-sio-len-for-pswpin-accounting-in-sio_read_complete +1 -1
@@ -497,7 +497,7 @@ static void sio_read_complete(struct kio
 			folio_mark_uptodate(folio);
 			folio_unlock(folio);
 		}
-		count_vm_events(PSWPIN, sio->pages);
+		count_vm_events(PSWPIN, sio->len >> PAGE_SHIFT);
 	} else {
 		for (p = 0; p < sio->pages; p++) {
 			struct folio *folio = page_folio(sio->bvec[p].bv_page);

_

Patches currently in -mm which might be from [email protected] are

mm-hugetlb-restore-reservation-on-error-in-hugetlb_mfill_atomic_pte-resubmission-path.patch