linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
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 13:44:44 +0100	[thread overview]
Message-ID: <ZxJYPK6o8Fjmx562@casper.infradead.org> (raw)
In-Reply-To: <30452c92-2fcd-4931-b58f-4d37713c84bc@redhat.com>

On Fri, Oct 18, 2024 at 01:07:43PM +0200, David Hildenbrand wrote:
> On 18.10.24 12:46, Matthew Wilcox wrote:
> > 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;
> >          }
> > 
> 
> Right, I recall that we are only touching the first page. IIRC, it's not
> necessarily a compound page.

That fits with how split_page_memcg() operates.

> > struct accounted_mem {
> > 	unsigned long flags;
> > 	struct obj_cgroup *objcg;
> > };
[...]
> > 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.
> 
> But how to do that without a compound page?

The first step is just an exercise in typing.  We'll use the exact same
bits for the exact same purpose, just eliminating all references to
page->memcg_data.  Later, we'll progress to separately allocating a
16-byte accounted_mem.


      reply	other threads:[~2024-10-18 12:44 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
2024-10-18 11:07     ` David Hildenbrand
2024-10-18 12:44       ` Matthew Wilcox [this message]

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=ZxJYPK6o8Fjmx562@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