lkml.org 
[lkml]   [2021]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v13 05/12] mm: hugetlb: allocate the vmemmap pages associated with each HugeTLB page
Date
On 28.01.21 23:29, Oscar Salvador wrote:
> On Wed, Jan 27, 2021 at 11:36:15AM +0100, David Hildenbrand wrote:
>> Extending on that, I just discovered that only x86-64, ppc64, and arm64
>> really support hugepage migration.
>>
>> Maybe one approach with the "magic switch" really would be to disable
>> hugepage migration completely in hugepage_migration_supported(), and
>> consequently making hugepage_movable_supported() always return false.
>
> Ok, so migration would not fork for these pages, and since them would
> lay in !ZONE_MOVABLE there is no guarantee we can unplug the memory.
> Well, we really cannot unplug it unless the hugepage is not used
> (it can be dissolved at least).
>
> Now to the allocation-when-freeing.
> Current implementation uses GFP_ATOMIC(or wants to use) + forever loop.
> One of the problems I see with GFP_ATOMIC is that gives you access
> to memory reserves, but there are more users using those reserves.
> Then, worst-scenario case we need to allocate 16MB order-0 pages
> to free up 1GB hugepage, so the question would be whether reserves
> really scale to 16MB + more users accessing reserves.
>
> As I said, if anything I would go for an optimistic allocation-try
> , if we fail just refuse to shrink the pool.
> User can always try to shrink it later again via /sys interface.
>
> Since hugepages would not be longer in ZONE_MOVABLE/CMA and are not
> expected to be migratable, is that ok?
>
> Using the hugepage for the vmemmap array was brought up several times,
> but that would imply fragmenting memory over time.
>
> All in all seems to be overly complicated (I might be wrong).
>
>
>> Huge pages would never get placed onto ZONE_MOVABLE/CMA and cannot be
>> migrated. The problem I describe would apply (careful with using
>> ZONE_MOVABLE), but well, it can at least be documented.
>
> I am not a page allocator expert but cannot the allocation fallback
> to ZONE_MOVABLE under memory shortage on other zones?

No, for now it's not done. Only movable allocations target ZONE_MOVABLE.
Doing so would be controversial: when would be the right point in time
to start spilling unmovable allocations into CMA/ZONE_MOVABLE? You
certainly want to try other things first (swapping, reclaim,
compaction), before breaking any guarantees regarding
hotunplug+migration/compaction you have with CMA/ZONE_MOVABLE. And even
if you would allow it, your workload would already suffer extremely.

So it smells more like a setup issue. But then, who knows when
allocating huge pages (esp. at runtime) that there are such side effects
before actually running into them?

We can make sure that all relevant archs support migration of ordinary
(!gigantic) huge pages (for now, only x86-64, ppc64/spapr, arm64), so we
can place them onto ZONE_MOVABLE. It gets harder with more special cases.

Gigantic pages (without CMA) are more of a general issue, but at least
it's simple to document ("Careful when pairing ZONE_MOVABLE with
gigantic pages on !CMA").

An unexpected high amount of unmovable memory is just extremely
difficult to handle with ZONE_MOVABLE; it's hard for the user/admin to
figure out that such restrictions actually apply.

--
Thanks,

David / dhildenb

\
 
 \ /
  Last update: 2021-02-01 16:55    [W:0.308 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site