linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Kent Overstreet <kent.overstreet@gmail.com>,
	Matthew Wilcox <willy@infradead.org>
Cc: linux-mm@kvack.org, Johannes Weiner <hannes@cmpxchg.org>
Subject: Re: Dynamically allocated memory descriptors
Date: Wed, 27 Oct 2021 14:14:38 +0200	[thread overview]
Message-ID: <5a55874d-80b9-b622-ec98-1bfdf3b251bf@redhat.com> (raw)
In-Reply-To: <YXg5M3yZcj8jOenL@moria.home.lan>

On 26.10.21 19:22, Kent Overstreet wrote:
> On Mon, Oct 25, 2021 at 08:55:21PM +0100, Matthew Wilcox wrote:
>> Kent asked:
>>> I ran into a major roadblock when I tried converting buddy allocator
>>> freelists to radix trees: freeing a page may require allocating a new
>>> page for the radix tree freelist, which is fine normally - we're freeing
>>> a page after all - but not if it's highmem. So right now I'm not sure
>>> if getting struct page down to two words is even possible. Oh well.
>>
>> I don't think I can answer this without explaining the whole design
>> I have in mind, so here goes ... this is far more complicated than
>> I would like it to be, but I think it *works*.
> 
> So you've got two separately allocated structs per compound page - struct buddy,
> for allocator/freelist state, and struct folio or slab or whatever, for
> allocatee state. This lets you get struct page - our 4k page tax - down to a
> single pointer.
> 
> But the shenanigans required for separately allocating struct buddy make me want
> to go back to my proposal :)
> 
> The difference between your proposal and mine is that in mine, we don't
> separately allocate struct buddy, instead we only shrink struct page down to two
> words/pointers, not one. We can get the state for a free page down to two words
> if we replace the doubly linked freelists with a dequeue implemented as a radix
> tree: the second word in struct page will be a pointer to allocatee state for
> allocated pages, but for free pages it will be an index onto the freelist.
> 
> As you also noted, splitting page->flags up between allocator state and
> allocatee state (i.e. moving some of it to the folio) means we'll be able to fit
> compound/buddy order in page->flags; that becomes the allocator state word in my
> model.
> 
> The issue I ran into was where we have to allocate new pages for the freelist
> radix tree: normally there's no issue here because we can just consume the page
> we're trying to free. But if the page is highmem - oof.

ZONE_MOVABLE and MIGRATE_CMA is similarly problematic, no?

-- 
Thanks,

David / dhildenb



      reply	other threads:[~2021-10-27 12:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-25 19:55 Matthew Wilcox
2021-10-26 17:22 ` Kent Overstreet
2021-10-27 12:14   ` David Hildenbrand [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=5a55874d-80b9-b622-ec98-1bfdf3b251bf@redhat.com \
    --to=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=kent.overstreet@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.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