Re: [PATCH v4 4/5] mm/zswap: Add per-memcg stat for proactive writeback
From: Yosry Ahmed
Date: Mon Jun 22 2026 - 19:42:29 EST
[..]
> static int zswap_writeback_entry(struct zswap_entry *entry,
> - swp_entry_t swpentry)
> + swp_entry_t swpentry,
> + bool proactive)
IIUC, if we refactor the code as I suggested in previous changes, we
don't really need to add an argument here..
> {
> struct xarray *tree;
> pgoff_t offset = swp_offset(swpentry);
> @@ -1045,6 +1047,15 @@ static int zswap_writeback_entry(struct zswap_entry *entry,
> if (entry->objcg)
> count_objcg_events(entry->objcg, ZSWPWB, 1);
>
> + if (proactive && entry->objcg) {
> + struct mem_cgroup *memcg;
> +
> + rcu_read_lock();
> + memcg = obj_cgroup_memcg(entry->objcg);
> + mod_memcg_state(memcg, MEMCG_ZSWPWB_PROACTIVE_B, entry->length);
> + rcu_read_unlock();
> + }
..and this chunk of code would end up in zswap_proactive_writeback().