From: Shaohua Li <shli@fb.com>
To: Benjamin LaHaise <bcrl@kvack.org>
Cc: linux-mm@kvack.org, Kernel-team@fb.com,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 2/2] aio: make aio .mremap handle size changes
Date: Tue, 3 Feb 2015 13:31:50 -0800 [thread overview]
Message-ID: <20150203213150.GA543371@devbig257.prn2.facebook.com> (raw)
In-Reply-To: <20150203194828.GU2974@kvack.org>
On Tue, Feb 03, 2015 at 02:48:28PM -0500, Benjamin LaHaise wrote:
> On Tue, Feb 03, 2015 at 11:31:15AM -0800, Shaohua Li wrote:
> > On Tue, Feb 03, 2015 at 02:23:23PM -0500, Benjamin LaHaise wrote:
> > > On Tue, Feb 03, 2015 at 11:18:53AM -0800, Shaohua Li wrote:
> > > > mremap aio ring buffer to another smaller vma is legal. For example,
> > > > mremap the ring buffer from the begining, though after the mremap, some
> > > > ring buffer pages can't be accessed in userspace because vma size is
> > > > shrinked. The problem is ctx->mmap_size isn't changed if the new ring
> > > > buffer vma size is changed. Latter io_destroy will zap all vmas within
> > > > mmap_size, which might zap unrelated vmas.
> > >
> > > Nak. Shrinking the aio ring buffer is not a supported operation and will
> > > cause the application to lose events. Make the size changing mremap fail,
> > > as this patch will not make the system do the right thing.
> >
> > Yes, making the syscall fail (vma ops has .remap) is another option. If
> > the app uses io_getevents(), looks the app will not lose events, no? On
> > the other hand, I just want to make sure kernel does the right thing
> > (not zap unrelated vmas). If app does crazy things, it will break.
>
> But reading events out of the ring buffer is a supported mode of operation.
> Given that constraint, you should make an mremap changing the size of the
> ring buffer fail.
But if app chooses not to read the ring buffer, the app isn't broken.
This makes me hesitate to make the syscall fail.
There is a grey area about what's the correct semantics for mremap. We
currently don't limit any vma shrink for mremap.
Thanks,
Shaohua
--
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>
next prev parent reply other threads:[~2015-02-03 21:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-03 19:18 [PATCH 1/2] mremap: don't allow VM_MIXEDMAP vma expanding Shaohua Li
2015-02-03 19:18 ` [PATCH 2/2] aio: make aio .mremap handle size changes Shaohua Li
2015-02-03 19:23 ` Benjamin LaHaise
2015-02-03 19:31 ` Shaohua Li
2015-02-03 19:48 ` Benjamin LaHaise
2015-02-03 21:31 ` Shaohua Li [this message]
2015-02-03 21:47 ` Benjamin LaHaise
2015-02-03 22:58 ` Shaohua Li
2015-02-03 23:25 ` Benjamin LaHaise
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=20150203213150.GA543371@devbig257.prn2.facebook.com \
--to=shli@fb.com \
--cc=Kernel-team@fb.com \
--cc=akpm@linux-foundation.org \
--cc=bcrl@kvack.org \
--cc=linux-mm@kvack.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