linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Shivank Garg <shivankgarg98@gmail.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	akpm@linux-foundation.org, gregkh@linuxfoundation.org,
	sergey.senozhatsky@gmail.com, pmladek@suse.com
Subject: Re: Is there a different memory allocation path other than the buddy allocator?
Date: Wed, 28 Apr 2021 16:44:36 +0200	[thread overview]
Message-ID: <88d5164f-0261-469c-5549-4d97a7936775@redhat.com> (raw)
In-Reply-To: <CAOVCmzEAMz4NGF3gi4O_tNUQfm2+-8AkGiOn0gPN+p3GHctkKA@mail.gmail.com>

On 28.04.21 09:37, Shivank Garg wrote:
> Hi Everyone!
> 
> I'm understanding memory allocation in Linux and doing some changes in
> buddy allocator (__alloc_pages_nodemask) for my experiments. I create
> a new flag in `struct page->flags` (by adding a new flag in `enum
> pageflags` in `page-flags.h`. I set this bit permanently in
> __alloc_pages_nodemask (to not to be cleared once set and survive all
> further allocation and freeing). But I'm not able to see expected
> behavior.
> 
> I'm guessing this is because Linux is also using some different path
> to allocate memory (probably during boot). Is my hypothesis correct?
> 
> Is there any different memory allocation path other than buddy
> allocator? Where can I find it?

memblock is the early memory allocator during boot, before the buddy is 
up and running. The range allocator (e.g., alloc_contig_range()) is some 
kind of mechanism that builds up on top of the buddy. Other allcoators 
(hugetlb, slab, ...) might cache some pages, but effectively get 
"physical memory" either via memblock or the buddy.

CMA is another special-purpose allocator which reserves physical memory 
areas via memblock and then uses the range allocator to actually 
allocate memory inside these reserved regions at runtime.

-- 
Thanks,

David / dhildenb



      reply	other threads:[~2021-04-28 14:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-28  7:37 Shivank Garg
2021-04-28 14:44 ` 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=88d5164f-0261-469c-5549-4d97a7936775@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pmladek@suse.com \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=shivankgarg98@gmail.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