From: Michal Hocko <mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: "Kirill A. Shutemov" <kirill-oKw7cIdHH8eLwutG50LtGA@public.gmane.org>
Cc: "Kirill A. Shutemov"
<kirill.shutemov-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
Ingo Molnar <mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
"H. Peter Anvin" <hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>,
Andi Kleen <ak-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
Dave Hansen <dave.hansen-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Andy Lutomirski <luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org>,
Dan Williams
<dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCHv5, REBASED 9/9] x86/mm: Allow to have userspace mappings above 47-bits
Date: Thu, 18 May 2017 19:51:58 +0200 [thread overview]
Message-ID: <20170518175158.GF30148@dhcp22.suse.cz> (raw)
In-Reply-To: <20170518171330.GA30148-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
On Thu 18-05-17 19:13:30, Michal Hocko wrote:
> On Thu 18-05-17 19:22:55, Kirill A. Shutemov wrote:
> > On Thu, May 18, 2017 at 05:59:14PM +0200, Michal Hocko wrote:
> [...]
> > > I basically mean something like the following
> > > ---
> > > diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c
> > > index 74d1587b181d..d6f66ff02d0a 100644
> > > --- a/arch/x86/kernel/sys_x86_64.c
> > > +++ b/arch/x86/kernel/sys_x86_64.c
> > > @@ -195,7 +195,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
> > > goto bottomup;
> > >
> > > /* requesting a specific address */
> > > - if (addr) {
> > > + if (addr && addr <= DEFAULT_MAP_WINDOW) {
> > > addr = PAGE_ALIGN(addr);
> > > vma = find_vma(mm, addr);
> > > if (TASK_SIZE - len >= addr &&
> > > @@ -215,7 +215,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
> > > * !in_compat_syscall() check to avoid high addresses for x32.
> > > */
> > > if (addr > DEFAULT_MAP_WINDOW && !in_compat_syscall())
> > > - info.high_limit += TASK_SIZE_MAX - DEFAULT_MAP_WINDOW;
> > > + info.high_limit += min(TASK_SIZE_MAX, address) - DEFAULT_MAP_WINDOW;
> > >
> > > info.align_mask = 0;
> > > info.align_offset = pgoff << PAGE_SHIFT;
> >
> > You try to stretch the interface too far. With the patch you propose we
> > have totally different behaviour wrt hint address if it below and above
> > 47-bits:
> >
> > * <= 47-bits: allocate VM [addr; addr + len - 1], if free;
>
> unless I am missing something fundamental here this is not how it works.
> We just map a different range if the requested one is not free (in
> absence of MAP_FIXED). And we do that in top->down direction so this is
> already how it works. And you _do_ rely on the same thing when allowing
> larger than 47b except you start from the top of the supported address
> space. So how exactly is your new behavior any different and more clear?
OK, I take that back because I am clearly wrong. We simply always start
from top. Sorry about my confusion.
Feel free to add
Acked-by: Michal Hocko <mhocko-IBi9RG/b67k@public.gmane.org>
--
Michal Hocko
SUSE Labs
prev parent reply other threads:[~2017-05-18 17:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20170515121218.27610-1-kirill.shutemov@linux.intel.com>
2017-05-15 12:12 ` [PATCHv5, REBASED 9/9] x86/mm: Allow to have userspace mappings above 47-bits Kirill A. Shutemov
[not found] ` <20170515121218.27610-10-kirill.shutemov-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-05-15 14:49 ` kbuild test robot
[not found] ` <201705152204.F4FmHH4W%fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-05-15 19:48 ` Kirill A. Shutemov
2017-05-18 11:43 ` Michal Hocko
[not found] ` <20170518114359.GB25471-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2017-05-18 15:19 ` Kirill A. Shutemov
2017-05-18 15:27 ` Michal Hocko
2017-05-18 15:41 ` Kirill A. Shutemov
2017-05-18 15:50 ` Michal Hocko
2017-05-18 15:59 ` Michal Hocko
2017-05-18 16:22 ` Kirill A. Shutemov
[not found] ` <20170518162255.l55tm5qbmnvvsgba-sVvlyX1904swdBt8bTSxpkEMvNT87kid@public.gmane.org>
2017-05-18 17:13 ` Michal Hocko
[not found] ` <20170518171330.GA30148-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2017-05-18 17:51 ` Michal Hocko [this message]
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=20170518175158.GF30148@dhcp22.suse.cz \
--to=mhocko-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=ak-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=dave.hansen-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org \
--cc=kirill-oKw7cIdHH8eLwutG50LtGA@public.gmane.org \
--cc=kirill.shutemov-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
--cc=luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org \
--cc=mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
--cc=x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
/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;
as well as URLs for NNTP newsgroup(s).