Re: [PATCH 1/3] mm, memcg: add mem_cgroup_disabled checks in vmpressure and swap-related functions

From: Shakeel Butt
Date: Fri Jul 09 2021 - 12:00:56 EST


On Thu, Jul 8, 2021 at 5:05 PM Suren Baghdasaryan <surenb@xxxxxxxxxx> wrote:
>
[...]

> --- a/mm/vmpressure.c
> +++ b/mm/vmpressure.c
> @@ -240,7 +240,12 @@ static void vmpressure_work_fn(struct work_struct *work)
> void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, bool tree,
> unsigned long scanned, unsigned long reclaimed)
> {
> - struct vmpressure *vmpr = memcg_to_vmpressure(memcg);
> + struct vmpressure *vmpr;
> +
> + if (mem_cgroup_disabled())
> + return;
> +
> + vmpr = memcg_to_vmpressure(memcg);

I was wondering why this was not crashing but realized that we
allocate root_mem_cgroup even in cgroup_disable=memory case.

Reviewed-by: Shakeel Butt <shakeelb@xxxxxxxxxx>