Re: [PATCH v2] mm: hugetlb: optionally allocate gigantic hugepages using cma

From: Rik van Riel
Date: Tue Mar 10 2020 - 16:38:11 EST


On Tue, 2020-03-10 at 13:29 -0700, Mike Kravetz wrote:
> On 3/10/20 1:15 PM, Rik van Riel wrote:
> > On Tue, 2020-03-10 at 13:11 -0700, Mike Kravetz wrote:
> > > the more I think about it, the more I like limiting CMA
> > > reservations
> > > to
> > > only one gigantic huge page size (per arch).
> >
> > Why, though?
> >
> > The cma_alloc function can return allocations of different
> > sizes at the same time.
> >
> > There is no limitation in the underlying code that would stop
> > a user from allocating hugepages of different sizes through
> > sysfs.
>
> True, there is no technical reason.
>
> I was only trying to simplify the setup and answer the outstanding
> questions.
> - What alignment to use for reservations?

Alignment can be the largest hugepage size the system
supports, assuming the amount of memory set aside is
at least this large?

> - What is minimum size of reservations?

One good thing is that it isn't really a reservation,
since the memory can still be used for things like page
cache and anonymous memory, so if too much is reserved
the memory does not go to waste.

One of my follow-up projects to Roman's project will be
to get THP & khugepaged to effectively use memory in the
hugepage CMA area, too.

That way when a system is running a workload that is not
using 1GB hugetlbfs pages, that easily defragmentable memory
pool will still bring some benefits to the workload.

> If only one gigantic page size is supported, the answer is
> simple. In any
> case, I think input from arch specific code will be needed.

Agreed.

--
All Rights Reversed.

Attachment: signature.asc
Description: This is a digitally signed message part