Re: [PATCH 2/2] mm/vmpressure: split v1 userspace eventfd code into vmpressure-v1.c

From: Michal Koutný

Date: Thu Jun 25 2026 - 05:01:05 EST


On Sat, Jun 06, 2026 at 04:41:34AM -0700, Usama Arif <usama.arif@xxxxxxxxx> wrote:
> Clean up mm/vmpressure.c by separating the cgroup v1 userspace eventfd
> interface from the shared and v2 in-kernel code.
>
> Currently, almost half of mm/vmpressure.c exists to serve tree=true:
> struct vmpressure_event, the events list and its mutex, the work_struct
> and vmpressure_work_fn that drains tree_scanned/tree_reclaimed, the
> parent walk, vmpressure_event(), vmpressure_register_event(),
> vmpressure_unregister_event(), and vmpressure_prio() (which always
> calls vmpressure() with tree=true).
>
> Move it all into a new mm/vmpressure-v1.c built only when
> CONFIG_MEMCG_V1=y (following the existing memcontrol-v1.o pattern).

Thanks for this dissection.

> @@ -283,14 +152,8 @@ void vmpressure(gfp_t gfp, int order, struct mem_cgroup *memcg, bool tree,
> return;
>
> if (tree) {
> - spin_lock(&vmpr->sr_lock);
> - scanned = vmpr->tree_scanned += scanned;
> - vmpr->tree_reclaimed += reclaimed;
> - spin_unlock(&vmpr->sr_lock);
> -
> - if (scanned < vmpressure_win)
> - return;
> - schedule_work(&vmpr->work);
> + vmpressure_v1_account_tree(vmpr, scanned, reclaimed);
> + return;
> } else {
> enum vmpressure_levels level;
>

This return; looks weird, I'd either
a) drop it or
b) keep it + de-indent the rest of the vmpressure().

Attachment: signature.asc
Description: PGP signature