From: David Rientjes <rientjes@google.com>
To: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Jonathan Corbet <corbet@lwn.net>,
Johannes Weiner <hannes@cmpxchg.org>,
mtk.manpages@gmail.com, Jerome Marchand <jmarchan@redhat.com>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
linux-man@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [patch] mm, madvise: fail with ENOMEM when splitting vma will hit max_map_count
Date: Wed, 25 Jan 2017 14:14:55 -0800 (PST) [thread overview]
Message-ID: <alpine.DEB.2.10.1701251407290.118946@chino.kir.corp.google.com> (raw)
In-Reply-To: <4c884355-0753-3b6e-a5a5-27b2a426c88b@linux.vnet.ibm.com>
On Wed, 25 Jan 2017, Anshuman Khandual wrote:
> But in the due course there might be other changes in number of VMAs of
> the process because of unmap() or merge() which could reduce the total
> number of VMAs and hence this condition may not exist afterwards. In
> that case EAGAIN still makes sense.
>
Imagine a singlethreaded process that is operating on its own privately
mapped memory. Attempting to split an existing vma and meeting
vm.max_map_count is not something that will be fixed by trying again, i.e.
it is not helpful to loop when madvise() returns -1 with errno EAGAIN if
vm.max_map_count will always be encountered. The other cases where ENOMEM
is blindly converted to EAGAIN is when slab allocation fails which can
encounter external freeing, the meaning of "kernel resource is temporarily
unavailable." There is no such guarantee for vm.max_map_count, so ENOMEM
clearly indicates the failure.
After this, it makes sense for userspace to loop for advice such as
MADV_DONTNEED because we are actively freeing memory when EAGAIN is
returned. If we are meeting vm.max_map_count, this will infinitely loop.
This is the case in tcmalloc and this patch addresses the issue when
vm.max_map_count is low.
--
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>
prev parent reply other threads:[~2017-01-25 22:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-24 22:32 David Rientjes
2017-01-24 22:32 ` [patch -man] madvise.2: Specify new ENOMEM return value David Rientjes
2017-01-25 10:30 ` [patch] mm, madvise: fail with ENOMEM when splitting vma will hit max_map_count Anshuman Khandual
2017-01-25 22:14 ` David Rientjes [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=alpine.DEB.2.10.1701251407290.118946@chino.kir.corp.google.com \
--to=rientjes@google.com \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=hannes@cmpxchg.org \
--cc=jmarchan@redhat.com \
--cc=khandual@linux.vnet.ibm.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-man@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mtk.manpages@gmail.com \
/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