LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Minchan Kim <minchan.kernel@gmail.com>
To: Martijn Coenen <maco@android.com>
Cc: "Minchan Kim" <minchan.kernel@gmail.com>,
	"Joel Fernandes" <joel@joelfernandes.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"Ganesh Mahendran" <opensource.ganesh@gmail.com>,
	"Joe Perches" <joe@perches.com>,
	"Arve Hjønnevåg" <arve@android.com>,
	"Todd Kjos" <tkjos@google.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Subject: Re: [PATCH v6] ANDROID: binder: change down_write to down_read
Date: Tue, 15 May 2018 17:56:10 +0900	[thread overview]
Message-ID: <20180515085610.GA98128@rodete-desktop-imager.corp.google.com> (raw)
In-Reply-To: <CAB0TPYHseQ-Lx4guzykjxY9xP2yP5Kga+oZMTmC7Bb7XXRAFFQ@mail.gmail.com>

On Tue, May 15, 2018 at 09:46:01AM +0200, Martijn Coenen wrote:

< snip >

> >> About the unmap at runtime part, your commit message was a bit confusing. You
> >> said "every binder buffers should be mapped in advance by binder_mmap." but I
> >> think the new binder shrinker mechanism doesn't make that true anymore.
> >
> > It's good point. I didn't know know that.
> > When I see binder_vm_fault, it emits SIGBUS. That means shrinker cannot zap pages
> > process is using, I think. IOW, every pages for binder are mapped at mmap time
> > and is never mapped in runtime by page fault. Right?
> 
> Right - the address range is allocated once, and an initial amount of
> pages is mapped into it. For every transaction into that process, we
> will see if there's enough pages, and if not allocate so that we have
> enough of them - so this is not done by page fault. The shrinker won't
> touch pages for which a transaction is in progress. Of course a
> process itself could still try to read from an unallocated address,
> but in that case returning SIGBUS and having that process crash seems
> fine.

Thanks for the confirmation.

> 
> I'm also not sure the read lock is needed, but I would need to read a
> whole lot more code to convince myself it's not.

For page zapping, we shouldn't need mmap_sem write lock.
We should replace it with down_read/write, too.

Thanks.

  reply	other threads:[~2018-05-15  8:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-07 14:15 Minchan Kim
2018-05-07 17:28 ` Joel Fernandes
2018-05-08 10:51   ` Minchan Kim
2018-05-08 23:08     ` Joel Fernandes
2018-05-09  6:40       ` Minchan Kim
2018-05-09 23:19         ` Joel Fernandes
2018-05-15  6:27           ` Minchan Kim
2018-05-15  7:46             ` Martijn Coenen
2018-05-15  8:56               ` Minchan Kim [this message]
2018-05-17  3:23             ` Joel Fernandes

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=20180515085610.GA98128@rodete-desktop-imager.corp.google.com \
    --to=minchan.kernel@gmail.com \
    --cc=arve@android.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=joel@joelfernandes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maco@android.com \
    --cc=opensource.ganesh@gmail.com \
    --cc=tkjos@google.com \
    --subject='Re: [PATCH v6] ANDROID: binder: change down_write to down_read' \
    /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

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