linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Joshua Hahn <joshua.hahnjy@gmail.com>
To: Gregory Price <gourry@gourry.net>
Cc: linux-mm@kvack.org, akpm@linux-foundation.org,
	kernel-team@meta.com, vbabka@suse.cz, surenb@google.com,
	mhocko@suse.com, jackmanb@google.com, hannes@cmpxchg.org,
	ziy@nvidia.com, linux-kernel@vger.kernel.org,
	David Hildenbrand <david@redhat.com>,
	Wei Yang <richard.weiyang@gmail.com>,
	Oscar Salvador <osalvador@suse.de>,
	David Rientjes <rientjes@google.com>
Subject: Re: [PATCH v3] page_alloc: allow migration of smaller hugepages during contig_alloc
Date: Mon,  1 Dec 2025 08:30:14 -0800	[thread overview]
Message-ID: <20251201163015.1438580-1-joshua.hahnjy@gmail.com> (raw)
In-Reply-To: <20251121191540.253624-1-gourry@gourry.net>

On Fri, 21 Nov 2025 14:15:40 -0500 Gregory Price <gourry@gourry.net> wrote:

> We presently skip regions with hugepages entirely when trying to do
> contiguous page allocation.  Instead, if hugepage migration is enabled,
> consider regions with hugepages smaller than the target contiguous
> allocation request as valid targets for allocation.
> 
> isolate_migrate_pages_block() already expects requests with hugepages
> to originate from alloc_contig, and hugetlb code also does a migratable
> check when isolating in folio_isolate_hugetlb().
> 
> Suggested-by: David Hildenbrand <david@redhat.com>
> Signed-off-by: Gregory Price <gourry@gourry.net>
> Reviewed-by: Zi Yan <ziy@nvidia.com>
> Reviewed-by: Wei Yang <richard.weiyang@gmail.com>
> Reviewed-by: Oscar Salvador <osalvador@suse.de>
> Acked-by: David Rientjes <rientjes@google.com>
> Acked-by: David Hildenbrand <david@redhat.com>

Hello folks, sorry for arriving late to the party, it seems like the patch
has gotten a lot of reviews already. I thought I would stop by to share
some simple testing that I've done: On a machine with 62GiB memory, I tried to
see if I could allocate a bunch of 2MB hugeTLB pages, then allocate 1GB hugeTLB
pages on top to see if that attempt would succeed.

To test this, I made a really simple setup:
1. Allocate 48GB worth of 2MB hugeTLB pages (24576)
2. Allocate 4 1G hugeTLB pages

Before this patch, I get 0 1G hugeTLB pages.
After this patch, I can get all 4 requested 1G hugeTLB pages!

I would share the script, but it really is just as simple as echoing 24576
and 4 to .../hugepages-{2048kB, 1048576kB}/nr_hugepages, respsectively.
If you want to reproduce this at home, you might have to change how many
2MB pages to allocate to see this difference, depending on the size of your
machine.

With this, please feel free to add:
Tested-by: Joshua Hahn <joshua.hahnjy@gmail.com>

Have a great day, everyone!
Joshua


  parent reply	other threads:[~2025-12-01 16:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-21 19:15 Gregory Price
2025-11-21 19:31 ` Andrew Morton
2025-11-21 19:42   ` Gregory Price
2025-12-01 16:30 ` Joshua Hahn [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-10-24 19:28 Gregory Price
2025-10-26  4:46 ` David Rientjes
2025-10-27  9:55 ` Oscar Salvador
2025-10-27 15:43 ` David Hildenbrand
2025-11-06 16:06   ` Gregory Price

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=20251201163015.1438580-1-joshua.hahnjy@gmail.com \
    --to=joshua.hahnjy@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=gourry@gourry.net \
    --cc=hannes@cmpxchg.org \
    --cc=jackmanb@google.com \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=osalvador@suse.de \
    --cc=richard.weiyang@gmail.com \
    --cc=rientjes@google.com \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    --cc=ziy@nvidia.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