Re: [PATCH v3] mm/page_io: use sio->len for PSWPIN accounting in sio_read_complete()
From: Andrew Morton
Date: Wed Apr 01 2026 - 18:58:18 EST
On Wed, 1 Apr 2026 10:32:30 +0200 "David Hildenbrand (Arm)" <david@xxxxxxxxxx> wrote:
> On 4/1/26 09:47, David Carlier wrote:
> > 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).
> >
> > Signed-off-by: David Carlier <devnexen@xxxxxxxxx>
>
> For the next time: Please don't send new revisions as reply to other
> revisions :)
Also, altering the Subject: causes akpm confusion (not hard). But
having accurate titles is more important than avoiding akpm confusion,
so there is that.
A little "what i changed since v2" note after the "---" separator is
helpful, please.
But I figured it out! Thanks, I'll pop this into my after-rc1 pile.