From: Matthew Wilcox <willy@infradead.org>
To: David Hildenbrand <david@redhat.com>
Cc: linux-mm@kvack.org, Yu Zhao <yuzhao@google.com>
Subject: Re: Next steps towards shrinking stuct page
Date: Fri, 18 Oct 2024 11:46:54 +0100 [thread overview]
Message-ID: <ZxI8nlNj_zq9bsZ4@casper.infradead.org> (raw)
In-Reply-To: <399f12d4-b01d-40bd-aba7-e3c565fbd8cb@redhat.com>
On Tue, Oct 08, 2024 at 04:16:39PM +0200, David Hildenbrand wrote:
> >
> > 4. Make sure that we're good with memcg_data. I think we are (it's only
> > used in folios and slabs today, I _think_), but it'll be good to be
> > sure. Someone who understands memcg better than I do can probably find
> > some stuff to clean up.
>
> Last time I looked at this (1month ago), I had the same impression.
I took a shot at this. The problem is mm/page_alloc.c:
__alloc_pages_noprof:
if (memcg_kmem_online() && (gfp & __GFP_ACCOUNT) && page &&
unlikely(__memcg_kmem_charge_page(page, gfp, order) != 0)) {
__free_pages(page, order);
page = NULL;
}
I think someone (maybe Yosry?) tried to explain this problem to me at
LSFMM, but I didn't understand.
Most of the places that use GFP_KERNEL_ACCOUNT are either page tables
or kmalloc/kvmalloc. But I think we're going to need a new memdesc
type for accounted memory.
struct accounted_mem {
unsigned long flags;
struct obj_cgroup *objcg;
};
(we'll be able to drop MEMCG_DATA_* once we have the memdesc type, but
we need to keep it until we're there).
So I guess that's my next step -- adding:
struct accounted_mem {
unsigned long flags;
unsigned long padding[5];
unsigned int padding2[2];
unsigned long objcg;
};
and the various assertions that objcg & flags occupy the same bytes in
accounted_mem as they do in page, until we separate them entirely.
next prev parent reply other threads:[~2024-10-18 10:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-25 17:39 Matthew Wilcox
2024-10-08 14:16 ` David Hildenbrand
2024-10-18 10:46 ` Matthew Wilcox [this message]
2024-10-18 11:07 ` David Hildenbrand
2024-10-18 12:44 ` Matthew Wilcox
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=ZxI8nlNj_zq9bsZ4@casper.infradead.org \
--to=willy@infradead.org \
--cc=david@redhat.com \
--cc=linux-mm@kvack.org \
--cc=yuzhao@google.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