linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-mm@kvack.org, Yu Zhao <yuzhao@google.com>
Subject: Re: Next steps towards shrinking stuct page
Date: Fri, 18 Oct 2024 13:07:43 +0200	[thread overview]
Message-ID: <30452c92-2fcd-4931-b58f-4d37713c84bc@redhat.com> (raw)
In-Reply-To: <ZxI8nlNj_zq9bsZ4@casper.infradead.org>

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.

> 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.

But how to do that without a compound page?

-- 
Cheers,

David / dhildenb



  reply	other threads:[~2024-10-18 11:07 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 [this message]
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=30452c92-2fcd-4931-b58f-4d37713c84bc@redhat.com \
    --to=david@redhat.com \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.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