From: Shakeel Butt <shakeelb@google.com>
To: Roman Gushchin <guro@fb.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Linux MM <linux-mm@kvack.org>, Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH v5 1/4] mm: memcontrol: use helpers to read page's memcg data
Date: Mon, 5 Oct 2020 08:12:25 -0700 [thread overview]
Message-ID: <CALvZod7EeQmg8h-5s1Jp+wYwvN+bEV407T9YaOLnW4WuvPM0Bg@mail.gmail.com> (raw)
In-Reply-To: <20201002172559.4000748-2-guro@fb.com>
On Fri, Oct 2, 2020 at 10:26 AM Roman Gushchin <guro@fb.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@fb.com>
> Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Reviewed-by: Shakeel Butt <shakeelb@google.com>
next prev parent reply other threads:[~2020-10-05 15:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-02 17:25 [PATCH v5 0/4] mm: allow mapping accounted kernel pages to userspace Roman Gushchin
2020-10-02 17:25 ` [PATCH v5 1/4] mm: memcontrol: use helpers to read page's memcg data Roman Gushchin
2020-10-05 15:12 ` Shakeel Butt [this message]
2020-10-14 14:37 ` Michal Hocko
2020-10-02 17:25 ` [PATCH v5 2/4] mm: memcontrol/slab: use helpers to access slab page's memcg_data Roman Gushchin
2020-10-05 15:13 ` Shakeel Butt
2020-10-02 17:25 ` [PATCH v5 3/4] mm: introduce page memcg flags Roman Gushchin
2020-10-05 14:57 ` Johannes Weiner
2020-10-14 14:37 ` Michal Hocko
2020-10-02 17:25 ` [PATCH v5 4/4] mm: convert page kmemcg type to a page memcg flag Roman Gushchin
2020-10-05 15:18 ` Shakeel Butt
2020-10-14 14:40 ` Michal Hocko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CALvZod7EeQmg8h-5s1Jp+wYwvN+bEV407T9YaOLnW4WuvPM0Bg@mail.gmail.com \
--to=shakeelb@google.com \
--cc=akpm@linux-foundation.org \
--cc=guro@fb.com \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).