mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Ilya Smith <blackzert@gmail.com>
Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com,
	x86@kernel.org, kirill.shutemov@linux.intel.com,
	dsafonov@virtuozzo.com, hughd@google.com,
	gregkh@linuxfoundation.org, craigb@google.com, oleg@redhat.com,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] Take mmap_min_addr into account while choosing unmapped address for x86-64.
Date: Wed, 28 Feb 2018 08:17:59 +0100	[thread overview]
Message-ID: <20180228071759.GN15357@dhcp22.suse.cz> (raw)
In-Reply-To: <B6A5E9B0-4986-4CD4-B01A-B6218D859579@gmail.com>

On Tue 27-02-18 16:27:29, Ilya Smith wrote:
> > 
> > mmap_min_addr handling is a bit mess... As you say, we would return
> > EPERM rather than ENOMEM which can be confusing but depleting the
> > address space like that is quite unlikely on 64b unless I am missing.
> > It is good to be in sync here with the generic implementation though,
> > IMO.
> > 
> 
> If we take a look on mm/mmap.c:
> #ifndef HAVE_ARCH_UNMAPPED_AREA_TOPDOWN
> unsigned long
> arch_get_unmapped_area_topdown(
> …
> 	if (len > TASK_SIZE - mmap_min_addr)
> 		return -ENOMEM;
> …
> 	info.low_limit = max(PAGE_SIZE, mmap_min_addr);
> 
> And this one looks like a generic implementation.
> But for many other architectures like arch/parisc/kernel/sys_parisc.c 
> or arch/x86/kernel/sys_x86_64.c
> 
> 	info.low_limit = PAGE_SIZE;

Yeah, this is what I meant when saying that mmap_min_addr is a bit of a
mess. I am wondering whether the low_limit should be checked inside
vm_unmapped_area. We would still need some mmap_min_addr handling at
arch_get_unmapped_area_topdown layer which is still suboptimal but I do
not see an easy way around without reworking how the arch specific parts
are implemented currently.
-- 
Michal Hocko
SUSE Labs

      reply	other threads:[~2018-02-28  7:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-26 21:12 Ilya Smith
2018-02-27  8:57 ` Michal Hocko
2018-02-27 13:27   ` Ilya Smith
2018-02-28  7:17     ` 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=20180228071759.GN15357@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=blackzert@gmail.com \
    --cc=craigb@google.com \
    --cc=dsafonov@virtuozzo.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=hughd@google.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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

all inboxes | Powered by JetHome®