linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mike Kravetz <mike.kravetz@oracle.com>
To: Vlastimil Babka <vbabka@suse.cz>,
	"C.Wehrmeyer" <c.wehrmeyer@gmx.de>,
	Michal Hocko <mhocko@kernel.org>
Cc: linux-mm@kvack.org, linux-kernel <linux-kernel@vger.kernel.org>,
	Andrea Arcangeli <aarcange@redhat.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: Re: PROBLEM: Remapping hugepages mappings causes kernel to return EINVAL
Date: Fri, 27 Oct 2017 10:06:01 -0700	[thread overview]
Message-ID: <2dad26cf-f37c-aada-053a-957c59c9858d@oracle.com> (raw)
In-Reply-To: <b27c7b12-beb3-abdd-fde1-3d48fa73ea81@suse.cz>

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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2017-10-27 17:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <93684e4b-9e60-ef3a-ba62-5719fdf7cff9@gmx.de>
2017-10-19  7:34 ` C.Wehrmeyer
2017-10-20 22:42   ` Mike Kravetz
2017-10-23 11:42     ` Michal Hocko
2017-10-23 12:22       ` C.Wehrmeyer
2017-10-23 12:41         ` Michal Hocko
2017-10-23 14:00           ` C.Wehrmeyer
2017-10-23 16:13             ` Michal Hocko
2017-10-23 16:46               ` C.Wehrmeyer
2017-10-23 16:57                 ` Michal Hocko
2017-10-23 17:52                   ` C.Wehrmeyer
2017-10-23 18:02                     ` Michal Hocko
2017-10-24  7:41                       ` C.Wehrmeyer
2017-10-24  8:12                         ` Michal Hocko
2017-10-24  8:32                           ` C.Wehrmeyer
2017-10-27 14:29                         ` Vlastimil Babka
2017-10-27 17:06                           ` Mike Kravetz [this message]
2017-10-27 17:31                           ` Kirill A. Shutemov
2017-10-23 18:51                     ` Mike Kravetz
2017-10-24  8:09                       ` C.Wehrmeyer
2017-10-07  1:58 C.Wehrmeyer
2017-10-09 16:47 ` Mike Kravetz

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=2dad26cf-f37c-aada-053a-957c59c9858d@oracle.com \
    --to=mike.kravetz@oracle.com \
    --cc=aarcange@redhat.com \
    --cc=c.wehrmeyer@gmx.de \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=vbabka@suse.cz \
    /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