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

From: Ye Liu

Date: Tue Apr 14 2026 - 20:47:41 EST




在 2026/4/14 21:18, Matthew Wilcox 写道:
> On Tue, Apr 14, 2026 at 05:15:17PM +0800, Ye Liu wrote:
>> From: Ye Liu <liuye@xxxxxxxxxx>
>>
>> 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