[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2dad26cf-f37c-aada-053a-957c59c9858d@oracle.com>
Date: Fri, 27 Oct 2017 10:06:01 -0700
From: Mike Kravetz <mike.kravetz@...cle.com>
To: Vlastimil Babka <vbabka@...e.cz>,
"C.Wehrmeyer" <c.wehrmeyer@....de>,
Michal Hocko <mhocko@...nel.org>
Cc: linux-mm@...ck.org, linux-kernel <linux-kernel@...r.kernel.org>,
Andrea Arcangeli <aarcange@...hat.com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Subject: Re: PROBLEM: Remapping hugepages mappings causes kernel to return
EINVAL
On 10/27/2017 07:29 AM, Vlastimil Babka wrote:
> On 10/24/2017 09:41 AM, C.Wehrmeyer wrote:
>> On 2017-10-23 20:02, Michal Hocko wrote:
>>> On Mon 23-10-17 19:52:27, C.Wehrmeyer wrote:
>>> [...]
>>
>> 1. Provide a flag to mmap, which might be something different from
>> MAP_HUGETLB. After all your question revolved merely around properly
>> aligned pages - we don't want to *force* the kernel to reserve
>> hugepages, we just want it to provide the proper alignment in this case.
>> That wouldn't be very transparent, but it would be the easiest route to
>> go (and mmap already kind-of supports such a thing).
>
> Maybe just have mmap() detect that the requested size is a multiple of
> huge page size, and then align it automatically? I.e. a heuristic that
> should work in 99% of the cases?
We already do this for DAX (see thp_get_unmapped_area). So, not much
code to write. But could potentially fragment address spaces more.
We could also check to determine if the system/process/mapping is even
THP enabled before doing the alignment.
I like the idea, but still am concerned about fragmentation. In addition,
even though applications shouldn't care where new mappings are placed it
would not surprise me that such a change will be noticeable to some.
--
Mike Kravetz
Powered by blists - more mailing lists