linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: "Kirill A. Shutemov" <kirill@shutemov.name>,
	Vegard Nossum <vegard.nossum@oracle.com>
Cc: linux-mm@kvack.org, Leon Yu <chianglungyu@gmail.com>,
	Konstantin Khlebnikov <koct9i@gmail.com>,
	Rik van Riel <riel@redhat.com>,
	Daniel Forrest <dan.forrest@ssec.wisc.edu>
Subject: Re: [PATCH] mm: correctly handle errors during VMA merging
Date: Tue, 26 Jul 2016 11:00:04 +0200	[thread overview]
Message-ID: <dad10820-47bd-4c6f-d7cf-b6bab665a6ea@suse.cz> (raw)
In-Reply-To: <20160726085344.GA7370@node.shutemov.name>

On 07/26/2016 10:53 AM, Kirill A. Shutemov wrote:
> On Tue, Jul 26, 2016 at 08:34:03AM +0200, Vegard Nossum wrote:
>> In other words, it is possible to run into a memory allocation error
>> *after* part of the merging work has already been done. In this case,
>> we probably shouldn't return an error back to userspace anyway (since
>> it would not reflect the partial work that was done).
>>
>> I *think* the solution might be to simply ignore the errors from
>> vma_adjust() and carry on with distinct VMAs for adjacent regions that
>> might otherwise have been represented with a single VMA.
>
> I don't like this.
>
> At least, vma_adjust() should be able to handle mering more than three
> vmas together on next call if memory pressure gone. I would keep virtual
> address space fragmentation within reasonable.
>
> I think this wouldn't be easy to validate...

As I said, this shouldn't happen unless the process is being killed 
already. Otherwise the allocation behaves like __GFP_NOFAIL. We could 
also make it explicitly __GFP_NOFAIL but that might only complicate OOM 
situations.

>> I have a reproducer that runs into the bug within a few seconds when
>> fault injection is enabled -- with the patch I no longer see any
>> problems.
>>
>> The patch and resulting code admittedly look odd and I'm *far* from
>> an expert on mm internals, so feel free to propose counter-patches and
>
> One idea is to pre-allocate anon_vma, if remove_next == 2 before merging
> started and use it on second iteration instead of allocation it in
> anon_vma_clone().

It's not just anon_vma, but also anon_vma_chains, their number is not 
constant.

--
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>

  reply	other threads:[~2016-07-26  9:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-26  6:34 Vegard Nossum
2016-07-26  7:03 ` Vlastimil Babka
2016-07-26  8:53 ` Kirill A. Shutemov
2016-07-26  9:00   ` Vlastimil Babka [this message]
2016-07-26  9:24   ` Vegard Nossum
2016-07-26 10:54     ` Kirill A. Shutemov
2016-07-26 11:48 ` Kirill A. Shutemov
2016-07-26 20:19   ` Vegard Nossum
2016-07-26 20:30     ` Kirill A. Shutemov
2016-07-27  5:40       ` Vegard Nossum

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=dad10820-47bd-4c6f-d7cf-b6bab665a6ea@suse.cz \
    --to=vbabka@suse.cz \
    --cc=chianglungyu@gmail.com \
    --cc=dan.forrest@ssec.wisc.edu \
    --cc=kirill@shutemov.name \
    --cc=koct9i@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=riel@redhat.com \
    --cc=vegard.nossum@oracle.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