From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: "C.Wehrmeyer" <c.wehrmeyer@gmx.de>,
Michal Hocko <mhocko@kernel.org>,
Mike Kravetz <mike.kravetz@oracle.com>,
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 20:31:54 +0300 [thread overview]
Message-ID: <20171027173154.a5msarm2qzlee3od@node.shutemov.name> (raw)
In-Reply-To: <b27c7b12-beb3-abdd-fde1-3d48fa73ea81@suse.cz>
On Fri, Oct 27, 2017 at 04:29:16PM +0200, 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:
> >> [...]
> >>>> or you can mmap a larger block and
> >>>> munmap the initial unaligned part.
> >>>
> >>> And how is that supposed to be transparent? When I hear "transparent" I
> >>> think of a mechanism which I can put under a system so that it benefits from
> >>> it, while the system does not notice or at least does not need to be aware
> >>> of it. The system also does not need to be changed for it.
> >>
> >> How do you expect to get a huge page when the mapping itself is not
> >> properly aligned?
> >
> > There are four ways that I can think of from the top of my head, but
> > only one of them would be actually transparent.
> >
> > 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?
Just don't bother.
Anon mapping for appliaction that would really benefit THP would grow
naturally: kernel will allocation new mapping next to the old one and
merge them. Doing fancy things here may hurt performance due to going
number of VMAs.
And we already do right thing for file mapping (tmpfs/shmem):
->get_unmapped_area would provide the right spot for the file, given the
size of mapping and ->vm_pgoff.
--
Kirill A. Shutemov
--
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>
next prev parent reply other threads:[~2017-10-27 17:31 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
2017-10-27 17:31 ` Kirill A. Shutemov [this message]
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=20171027173154.a5msarm2qzlee3od@node.shutemov.name \
--to=kirill@shutemov.name \
--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=mike.kravetz@oracle.com \
--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