From: Michal Hocko <mhocko@kernel.org>
To: Mike Kravetz <mike.kravetz@oracle.com>
Cc: "C.Wehrmeyer" <c.wehrmeyer@gmx.de>,
linux-mm@kvack.org, linux-kernel <linux-kernel@vger.kernel.org>,
Andrea Arcangeli <aarcange@redhat.com>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Vlastimil Babka <vbabka@suse.cz>
Subject: Re: PROBLEM: Remapping hugepages mappings causes kernel to return EINVAL
Date: Mon, 23 Oct 2017 13:42:10 +0200 [thread overview]
Message-ID: <20171023114210.j7ip75ewoy2tiqs4@dhcp22.suse.cz> (raw)
In-Reply-To: <5fb8955d-23af-ec85-a19f-3a5b26cc04d1@oracle.com>
On Fri 20-10-17 15:42:25, Mike Kravetz wrote:
> On 10/19/2017 12:34 AM, C.Wehrmeyer wrote:
[...]
> > As for the specific use case: I've written my own allocator that is
> > not bound on the same limitations that usual malloc/realloc/free
> > allocators are bound. As such I want to be able to eliminate as many
> > page walks as possible.
> >
> > Just excepting the limitation would put Linux down on the same level
> > as the Windows API, where no VirtualRealloc exists. My allocator
> > needs to work with Linux and Windows; for the latter one I'm already
> > managing a table of consecutive mappings in user-space that, if
> > a relocation has to be made, creates an entirely new mapping
> > into which the data of the previous mappings is copied. This is
> > redundant, because the kernel and the process keep their own copies
> > of the mapping table, and this is slow because the kernel could just
> > re-adjust the position within the address space, whereas the process
> > has to memcpy all the data from the old to the new mappings.
> >
> > Those are the very problems mremap was supposed to remove in the
> > first place. Making the limitation documented is the lazy way that
> > will force implementers to workaround it.
>
> mremap has never supported moving or growing hugetlb mappings. Someone
> (before git history) added this explicit check to the mremap code. Perhaps
> it was done when huge page support was introduced?
yes, that is the case.
> I am of the opinion that we should simply document this limitation. AFAIK,
> this this the first time anyone has asked about it in 15 years. What is the
> opinion of others?
I do not remember any such a request either. I can see some merit in the
described use case. It is not specific on why hugetlb pages are used for
the allocator memory because that comes with it own issues. If somebody
is really thrilled enough to implement this the remapping feature for
hugetlb I wouldn't be opposed as long as the implementation is clean and
wouldn't add an additional mess to the code base. I suspect that the vma
enlarging might be a hard deal. Anyway starting with a documentation
update sounds like a good thing anyway. In any case such a feature will
be available only for new kernels so people should be aware of the state
on older kernels.
--
Michal Hocko
SUSE Labs
--
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-23 11:42 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 [this message]
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
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=20171023114210.j7ip75ewoy2tiqs4@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--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=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