Re: [PATCH v2 00/11] mm: memcontrol: constify the read side of the memcg API
From: Lorenzo Stoakes (ARM)
Date: Wed Sep 16 2026 - 09:38:14 EST
On Tue, Sep 08, 2026 at 11:57:36AM -0400, Tal Zussman wrote:
> The memcg accessors, lruvec helpers, and stat readers only read from
> the memcg, folio, or lruvec they are given, but take non-const
> pointers. Constify them, along with a couple other helper functions in
> mm/page_counter.c along the way.
>
> This started as a follow-up to [1] that quickly grew in proportions :)
>
> [1]: https://lore.kernel.org/linux-mm/anYqSDnC2BbJXv1h@xxxxxxxxxxxxxxxxxxxx/
:)
I looked through it, all looks sensible, and it compiles locally and
const-ifies things so it's all good AFAIC! So:
Acked-by: Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx>
For the whole series :)
>
> ---
> Changes in v2:
> - Patch 3: Constify the folio argument of folio_lruvec_relock_irq() and
> folio_lruvec_relock_irqsave() as well, per Sashiko
> - Patch 3: Note that mem_cgroup_lruvec() updates lruvec->pgdat in the
> per-node structure, not the memcg, per Sashiko
> - Patches 3 and 8: Use container_of_const() in lruvec_memcg() and the
> lruvec_page_state() family, per Sashiko
> - Link to v1: https://patch.msgid.link/20260902-folio_memcg-const-v1-0-e2c1da22246d@xxxxxxxxxxxx
>
> ---
> Tal Zussman (11):
> mm: memcontrol: take a const folio in folio_memcg() and friends
> mm: memcontrol: constify obj_cgroup_memcg() and friends
> mm: memcontrol: constify the lruvec helpers
> mm/page_io: take a const folio in bio_associate_blkg_from_folio()
> mm: memcontrol: constify the mem_cgroup accessors
> mm: page_counter: constify page_counter_read() and page_counter_margin()
> mm: memcontrol: constify the reclaim protection helpers
> mm: memcontrol: constify the memcg and lruvec stat readers
> mm: memcontrol: constify the swap accounting helpers
> mm: memcontrol: constify mem_cgroup_swappiness() and mem_cgroup_get_max()
> mm: memcontrol: constify the zswap and socket pressure helpers
>
> include/linux/memcontrol.h | 204 ++++++++++++++++++++++---------------------
> include/linux/mmzone.h | 2 +-
> include/linux/page_counter.h | 4 +-
> include/linux/swap.h | 12 +--
> mm/memcontrol.c | 49 ++++++-----
> mm/page_counter.c | 2 +-
> mm/page_io.c | 14 +--
> mm/swap.h | 2 +-
> 8 files changed, 148 insertions(+), 141 deletions(-)
> ---
> base-commit: 9d3243fc689fef444f87e0a703b4c99653137e1b
> change-id: 20260807-folio_memcg-const-4a67e40d485b
>
> Best regards,
> --
> Tal Zussman <tz2294@xxxxxxxxxxxx>
>
--
Cheers, Lorenzo