[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALvZod7EeQmg8h-5s1Jp+wYwvN+bEV407T9YaOLnW4WuvPM0Bg@mail.gmail.com>
Date: Mon, 5 Oct 2020 08:12:25 -0700
From: Shakeel Butt <shakeelb@...gle.com>
To: Roman Gushchin <guro@...com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
Linux MM <linux-mm@...ck.org>, Kernel Team <kernel-team@...com>
Subject: Re: [PATCH v5 1/4] mm: memcontrol: use helpers to read page's memcg data
On Fri, Oct 2, 2020 at 10:26 AM Roman Gushchin <guro@...com> wrote:
>
> Currently there are many open-coded reads of the page->mem_cgroup
> pointer, as well as a couple of read helpers, which are barely used.
>
> It creates an obstacle on a way to reuse some bits of the pointer
> for storing additional bits of information. In fact, we already do
> this for slab pages, where the last bit indicates that a pointer has
> an attached vector of objcg pointers instead of a regular memcg
> pointer.
>
> This commits uses 2 existing helpers and introduces a new helper to
> converts all read sides to calls of these helpers:
> struct mem_cgroup *page_memcg(struct page *page);
> struct mem_cgroup *page_memcg_rcu(struct page *page);
> struct mem_cgroup *page_memcg_check(struct page *page);
>
> page_memcg_check() is intended to be used in cases when the page
> can be a slab page and have a memcg pointer pointing at objcg vector.
> It does check the lowest bit, and if set, returns NULL.
> page_memcg() contains a VM_BUG_ON_PAGE() check for the page not
> being a slab page.
>
> To make sure nobody uses a direct access, struct page's
> mem_cgroup/obj_cgroups is converted to unsigned long memcg_data.
>
> Signed-off-by: Roman Gushchin <guro@...com>
> Acked-by: Johannes Weiner <hannes@...xchg.org>
Reviewed-by: Shakeel Butt <shakeelb@...gle.com>
Powered by blists - more mailing lists