[PATCH 0/4] mm/vmstat: simplify folio stat APIs

Ye Liu posted 4 patches 2 months ago
fs/nfs/internal.h      |  2 +-
fs/nfs/write.c         |  2 +-
include/linux/vmstat.h | 36 ------------------------------------
mm/compaction.c        |  5 ++---
mm/gup.c               |  5 ++---
mm/khugepaged.c        | 10 ++++------
mm/mempolicy.c         |  5 ++---
mm/migrate.c           | 12 +++++-------
mm/mlock.c             |  6 +++---
mm/page-writeback.c    | 16 ++++++++--------
mm/page_alloc.c        |  2 +-
mm/swap_state.c        |  4 ++--
12 files changed, 31 insertions(+), 74 deletions(-)
[PATCH 0/4] mm/vmstat: simplify folio stat APIs
Posted by Ye Liu 2 months ago
From: Ye Liu <liuye@kylinos.cn>

This series simplifies folio statistics accounting by:
1. Replacing node_stat_mod_folio/zone_stat_mod_folio with more semantic
   add_folio/sub_folio functions
2. Removing unused __node_stat_* and __zone_stat_* wrapper functions

Ye Liu (4):
  mm/vmstat: use node_stat_add_folio/sub_folio for folio_nr_pages
    operations
  mm/vmstat: use zone_stat_add_folio/sub_folio for folio_nr_pages
    operations
  mm/vmstat: remove unused __node_stat_* wrappers
  mm/vmstat: remove unused __zone_stat_* wrappers

 fs/nfs/internal.h      |  2 +-
 fs/nfs/write.c         |  2 +-
 include/linux/vmstat.h | 36 ------------------------------------
 mm/compaction.c        |  5 ++---
 mm/gup.c               |  5 ++---
 mm/khugepaged.c        | 10 ++++------
 mm/mempolicy.c         |  5 ++---
 mm/migrate.c           | 12 +++++-------
 mm/mlock.c             |  6 +++---
 mm/page-writeback.c    | 16 ++++++++--------
 mm/page_alloc.c        |  2 +-
 mm/swap_state.c        |  4 ++--
 12 files changed, 31 insertions(+), 74 deletions(-)

-- 
2.43.0
Re: [PATCH 0/4] mm/vmstat: simplify folio stat APIs
Posted by Matthew Wilcox 2 months ago
On Tue, Apr 14, 2026 at 05:15:17PM +0800, Ye Liu wrote:
> From: Ye Liu <liuye@kylinos.cn>
> 
> This series simplifies folio statistics accounting by:
> 1. Replacing node_stat_mod_folio/zone_stat_mod_folio with more semantic
>    add_folio/sub_folio functions
> 2. Removing unused __node_stat_* and __zone_stat_* wrapper functions

I'm not convinced this is the right approach.  We've often computed
folio_nr_pages() for use by several different functions, and you're
making us recompute it.
Re: [PATCH 0/4] mm/vmstat: simplify folio stat APIs
Posted by Ye Liu 2 months ago

在 2026/4/14 21:18, Matthew Wilcox 写道:
> On Tue, Apr 14, 2026 at 05:15:17PM +0800, Ye Liu wrote:
>> From: Ye Liu <liuye@kylinos.cn>
>>
>> This series simplifies folio statistics accounting by:
>> 1. Replacing node_stat_mod_folio/zone_stat_mod_folio with more semantic
>>    add_folio/sub_folio functions
>> 2. Removing unused __node_stat_* and __zone_stat_* wrapper functions
> 
> I'm not convinced this is the right approach.  We've often computed
> folio_nr_pages() for use by several different functions, and you're
> making us recompute it.


Thank you for your feedback, Matthew. I acknowledge that this change may
introduce additional calls to folio_nr_pages() in some cases where the
value was previously computed once and reused. However, the new
add_folio/sub_folio functions provide clearer semantics, explicitly
indicating that we're accounting for the entire folio rather than
potentially partial pages. The overhead of recomputing folio_nr_pages()
is minimal in most scenarios, and the improved readability and reduced
argument passing outweigh this concern.

-- 
Thanks,
Ye Liu

Re: [PATCH 0/4] mm/vmstat: simplify folio stat APIs
Posted by Matthew Wilcox 2 months ago
On Wed, Apr 15, 2026 at 08:47:24AM +0800, Ye Liu wrote:
> Thank you for your feedback, Matthew. I acknowledge that this change may
> introduce additional calls to folio_nr_pages() in some cases where the
> value was previously computed once and reused. However, the new
> add_folio/sub_folio functions provide clearer semantics, explicitly
> indicating that we're accounting for the entire folio rather than
> potentially partial pages. The overhead of recomputing folio_nr_pages()
> is minimal in most scenarios, and the improved readability and reduced
> argument passing outweigh this concern.

I disagree.
Re: [PATCH 0/4] mm/vmstat: simplify folio stat APIs
Posted by Ye Liu 2 months ago

在 2026/4/15 11:59, Matthew Wilcox 写道:
> On Wed, Apr 15, 2026 at 08:47:24AM +0800, Ye Liu wrote:
>> Thank you for your feedback, Matthew. I acknowledge that this change may
>> introduce additional calls to folio_nr_pages() in some cases where the
>> value was previously computed once and reused. However, the new
>> add_folio/sub_folio functions provide clearer semantics, explicitly
>> indicating that we're accounting for the entire folio rather than
>> potentially partial pages. The overhead of recomputing folio_nr_pages()
>> is minimal in most scenarios, and the improved readability and reduced
>> argument passing outweigh this concern.
> 
> I disagree.

Thanks for the direct feedback.

-- 
Thanks,
Ye Liu