From: Michal Hocko <mhocko@suse.com>
To: Shakeel Butt <shakeelb@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Roman Gushchin <guro@fb.com>,
Muchun Song <songmuchun@bytedance.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] memcg: add per-memcg vmalloc stat
Date: Mon, 27 Dec 2021 11:48:35 +0100 [thread overview]
Message-ID: <YcmaA9BS/DSB/iER@dhcp22.suse.cz> (raw)
In-Reply-To: <20211222052457.1960701-1-shakeelb@google.com>
On Tue 21-12-21 21:24:57, Shakeel Butt wrote:
> The kvmalloc* allocation functions can fallback to vmalloc allocations
> and more often on long running machines. In addition the kernel does
> have __GFP_ACCOUNT kvmalloc* calls. So, often on long running machines,
> the memory.stat does not tell the complete picture which type of memory
> is charged to the memcg. So add a per-memcg vmalloc stat.
>
> Signed-off-by: Shakeel Butt <shakeelb@google.com>
The counter is useful IMHO. I just have one implementation specific
question.
[...]
> @@ -2626,6 +2627,9 @@ static void __vunmap(const void *addr, int deallocate_pages)
> unsigned int page_order = vm_area_page_order(area);
> int i;
>
> + mod_memcg_page_state(area->pages[0], MEMCG_VMALLOC,
> + -(int)area->nr_pages);
> +
> for (i = 0; i < area->nr_pages; i += 1U << page_order) {
> struct page *page = area->pages[i];
>
> @@ -2964,6 +2968,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
> page_order, nr_small_pages, area->pages);
>
> atomic_long_add(area->nr_pages, &nr_vmalloc_pages);
> + mod_memcg_page_state(area->pages[0], MEMCG_VMALLOC, area->nr_pages);
>
> /*
> * If not enough pages were obtained to accomplish an
Is it safe to assume that the whole area is always charged to the same
memcg? I am not really deeply familiar with vmalloc internals but is it
possible that an area could get resized/partially reused with a
different charging context?
A clarification comment would be really handy.
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2021-12-27 10:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-22 5:24 Shakeel Butt
2021-12-22 5:50 ` Muchun Song
2021-12-22 6:06 ` Shakeel Butt
2021-12-23 2:02 ` Roman Gushchin
2021-12-23 2:32 ` Matthew Wilcox
2021-12-23 17:44 ` Shakeel Butt
2021-12-23 20:27 ` Roman Gushchin
2021-12-27 10:48 ` Michal Hocko [this message]
2021-12-30 19:06 ` Shakeel Butt
2022-01-03 11:58 ` 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=YcmaA9BS/DSB/iER@dhcp22.suse.cz \
--to=mhocko@suse.com \
--cc=akpm@linux-foundation.org \
--cc=guro@fb.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shakeelb@google.com \
--cc=songmuchun@bytedance.com \
/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