[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190114164004.GL21345@dhcp22.suse.cz>
Date: Mon, 14 Jan 2019 17:40:04 +0100
From: Michal Hocko <mhocko@...nel.org>
To: "Harrosh, Boaz" <Boaz.Harrosh@...app.com>
Cc: "Kirill A. Shutemov" <kirill@...temov.name>,
Mike Kravetz <mike.kravetz@...cle.com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Hugh Dickins <hughd@...gle.com>,
Dan Williams <dan.j.williams@...el.com>,
Matthew Wilcox <willy@...radead.org>,
Toshi Kani <toshi.kani@....com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [RFC PATCH] mm: align anon mmap for THP
On Mon 14-01-19 16:29:29, Harrosh, Boaz wrote:
> Kirill A. Shutemov <kirill@...temov.name> wrote:
> > On Fri, Jan 11, 2019 at 03:28:37PM -0800, Mike Kravetz wrote:
> >> Ok, I just wanted to ask the question. I've seen application code doing
> >> the 'mmap sufficiently large area' then unmap to get desired alignment
> >> trick. Was wondering if there was something we could do to help.
> >
> > Application may want to get aligned allocation for different reasons.
> > It should be okay for userspace to ask for size + (alignment - PAGE_SIZE)
> > and then round up the address to get the alignment. We basically do the
> > same on kernel side.
> >
>
> This is what we do and will need to keep doing for old Kernels.
> But it is a pity that those holes can not be reused for small maps, and most important
> that we cannot have "mapping holes" around the mapping that catch memory
> overruns
What does prevent you from mapping a larger area and MAP_FIXED,
PROT_NONE over it to get the protection?
> > For THP, I believe, kernel already does The Right Thing™ for most users.
> > User still may want to get speific range as THP (to avoid false sharing or
> > something).
>
> I'm an OK Kernel programmer. But I was not able to create a HugePage mapping
> against /dev/shm/ in a reliable way. I think it only worked on Fedora 28/29
> but not on any other distro/version. (MMAP_HUGE)
Are you mixing hugetlb rather than THP?
> We run with our own compiled Kernel on various distros, THP is configured
> in but mmap against /dev/shm/ never gives me Huge pages. Does it only
> work with unanimous mmap ? (I think it is mount dependent which is not
> in the application control)
If you are talking about THP then you have to enable huge pages for the
mapping AFAIR.
--
Michal Hocko
SUSE Labs
Powered by blists - more mailing lists