linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Ge Yang <yangge1116@126.com>, akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, 21cnbao@gmail.com,
	baolin.wang@linux.alibaba.com, muchun.song@linux.dev,
	liuzixing@hygon.cn
Subject: Re: [PATCH] replace free hugepage folios after migration
Date: Wed, 8 Jan 2025 22:05:18 +0100	[thread overview]
Message-ID: <fc1241a6-6760-4f73-840d-4f3a538644aa@redhat.com> (raw)
In-Reply-To: <d6d92a36-4ed7-4ae8-8b74-48f79a502a36@126.com>

Sorry for the late reply, holidays ...

>> Did you ever try allocating a larger range with a single
>> alloc_contig_range() call, that possibly has to migrate multiple hugetlb
>> folios in one go (and maybe just allocates one of the just-freed hugetlb
>> folios as migration target)?
>>
> 
> I have tried using a single alloc_contig_range() call to allocate a
> larger contiguous range, and it works properly. This is because during
> the period between __alloc_contig_migrate_range() and
> isolate_freepages_range(), no one allocates a hugetlb folio from the
> free hugetlb pool.

Did you trigger the following as well?

alloc_contig_range() that covers multiple in-use hugetlb pages, like

[ huge 0 ] [ huge 1 ] [ huge 2 ] [ huge 3 ]

I assume the following happens:

To migrate huge 0, we have to allocate a fresh page from the buddy. 
After migration, we return now-free huge 0 to the pool.

To migrate huge 1, we can just grab now-free huge 0 from the pool, and 
not allocate a fresh one from the buddy.

At least that's my impression when reading 
alloc_migration_target()->alloc_hugetlb_folio_nodemask().

Or is for some reason available_huge_pages()==false and we always end up 
in alloc_migrate_hugetlb_folio()->alloc_fresh_hugetlb_folio()?

Sorry for the stupid questions, the code is complicated, and I cannot 
see how this would work.

-- 
Cheers,

David / dhildenb



  reply	other threads:[~2025-01-08 21:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-18  6:33 yangge1116
2024-12-19 16:40 ` David Hildenbrand
2024-12-20  8:56   ` Ge Yang
2024-12-20 16:30     ` David Hildenbrand
2024-12-21 12:04       ` Ge Yang
2024-12-21 14:32         ` David Hildenbrand
2024-12-22 11:50           ` Ge Yang
2024-12-19 18:43 ` SeongJae Park
2024-12-20  9:03   ` Ge Yang
2024-12-21 14:35 ` David Hildenbrand
2024-12-22  8:13   ` Ge Yang
2025-01-08 21:05     ` David Hildenbrand [this message]
2025-01-09  9:50       ` Ge Yang

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=fc1241a6-6760-4f73-840d-4f3a538644aa@redhat.com \
    --to=david@redhat.com \
    --cc=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liuzixing@hygon.cn \
    --cc=muchun.song@linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=yangge1116@126.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