linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Gregory Price <gourry@gourry.net>
To: David Hildenbrand <david@redhat.com>
Cc: linux-mm@kvack.org, osalvador@suse.de, corbet@lwn.net,
	muchun.song@linux.dev, akpm@linux-foundation.org,
	hannes@cmpxchg.org, laoar.shao@gmail.com, mclapinski@google.com,
	joel.granados@kernel.org, jack@suse.cz,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Mel Gorman <mgorman@suse.de>, Michal Hocko <mhocko@suse.com>,
	Alexandru Moise <00moses.alexander00@gmail.com>,
	David Rientjes <rientjes@google.com>
Subject: Re: [RFC PATCH] mm, hugetlb: implement movable_gigantic_pages sysctl
Date: Mon, 20 Oct 2025 12:35:25 -0400	[thread overview]
Message-ID: <aPZkzY6cGfdKo8K8@gourry-fedora-PF4VCD3F> (raw)
In-Reply-To: <aPZd1dAIzAw7Ii8E@gourry-fedora-PF4VCD3F>

On Mon, Oct 20, 2025 at 12:05:41PM -0400, Gregory Price wrote:
> On Mon, Oct 20, 2025 at 04:17:06PM +0200, David Hildenbrand wrote:
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 5549b32cdd31..5def2c53092e 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -6922,8 +6922,12 @@ static bool pfn_range_valid_contig(struct zone *z, unsigned long start_pfn,
>                 if (PageReserved(page))
>                         return false;
> 
> -               if (PageHuge(page))
> -                       return false;
> +               if (PageHuge(page)) {
> +                       /* Don't consider moving same size/larger pages */
> +                       if (!CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION ||
> +                           ((1 << compound_order(page)) >= nr_pages))
> +                               return false;
> +               }
>         }
>         return true;
>  }

Quick spot-check of the compaction code suggests this is handled
essentially the same way - and in fact compaction expects
alloc_contig to be sending compaction requests w/ hugepages.

So I'll go ahead and submit this separately for discussion.

~Gregory

---

->isolate_migratepages_range()
->isolate_migratepages_block()
{
...
	if (PageHuge(page)) {
		const unsigned int order = compound_order(page);
		/*
		 * skip hugetlbfs if we are not compacting for pages
		 * bigger than its order. THPs and other compound pages
		 * are handled below.
		 */
		 ...
		/* for alloc_contig case */
		if (locked) {
			unlock_page_lruvec_irqrestore(locked, flags);
			locked = NULL;
		}

	 }
...
	/*
	 * Regardless of being on LRU, compound pages such as THP
	 * (hugetlbfs is handled above) are not to be compacted unless
	 * we are attempting an allocation larger than the compound
	 * page size. We can potentially save a lot of iterations if we
	 * skip them at once. The check is racy, but we can consider
	 * only valid values and the only danger is skipping too much.
	 */
	if (PageCompound(page) && !cc->alloc_contig) {
		const unsigned int order = compound_order(page);

		/* Skip based on page order and compaction target order. */
		if (skip_isolation_on_order(order, cc->order)) {
			if (order <= MAX_PAGE_ORDER) {
				low_pfn += (1UL << order) - 1;
				nr_scanned += (1UL << order) - 1;
			}
			goto isolate_fail;
		}
	}
}


      reply	other threads:[~2025-10-20 16:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-09 16:15 Gregory Price
2025-10-20 14:17 ` David Hildenbrand
2025-10-20 14:22   ` Gregory Price
2025-10-20 16:05   ` Gregory Price
2025-10-20 16:35     ` Gregory Price [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=aPZkzY6cGfdKo8K8@gourry-fedora-PF4VCD3F \
    --to=gourry@gourry.net \
    --cc=00moses.alexander00@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=corbet@lwn.net \
    --cc=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=jack@suse.cz \
    --cc=joel.granados@kernel.org \
    --cc=laoar.shao@gmail.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mclapinski@google.com \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=osalvador@suse.de \
    --cc=rientjes@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