linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 4/4] mm: convert page kmemcg type to a page memcg flag
Date: Mon, 5 Oct 2020 08:18:10 -0700	[thread overview]
Message-ID: <CALvZod7OQOF+6i=oWokXmTTc0OymsLEyKGkt+i2rEMT=HWfWKQ@mail.gmail.com> (raw)
In-Reply-To: <20201002172559.4000748-5-guro@fb.com>

On Fri, Oct 2, 2020 at 10:26 AM Roman Gushchin <guro@fb.com> wrote:
>
> PageKmemcg flag is currently defined as a page type (like buddy,
> offline, table and guard). Semantically it means that the page
> was accounted as a kernel memory by the page allocator and has
> to be uncharged on the release.
>
> As a side effect of defining the flag as a page type, the accounted
> page can't be mapped to userspace (look at page_has_type() and
> comments above). In particular, this blocks the accounting of
> vmalloc-backed memory used by some bpf maps, because these maps
> do map the memory to userspace.
>
> One option is to fix it by complicating the access to page->mapcount,
> which provides some free bits for page->page_type.
>
> But it's way better to move this flag into page->memcg_data flags.
> Indeed, the flag makes no sense without enabled memory cgroups
> and memory cgroup pointer set in particular.
>
> This commit replaces PageKmemcg() and __SetPageKmemcg() with
> PageMemcgKmem() and an open-coded OR operation setting the memcg
> pointer with the MEMCG_DATA_KMEM bit. __ClearPageKmemcg() can be
> simple deleted, as the whole memcg_data is zeroed at once.
>
> As a bonus, on !CONFIG_MEMCG build the PageMemcgKmem() check will
> be compiled out.
>
> Signed-off-by: Roman Gushchin <guro@fb.com>
> Acked-by: Johannes Weiner <hannes@cmpxchg.org>

Reviewed-by: Shakeel Butt <shakeelb@google.com>

  reply	other threads:[~2020-10-05 15:18 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
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 [this message]
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='CALvZod7OQOF+6i=oWokXmTTc0OymsLEyKGkt+i2rEMT=HWfWKQ@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).