linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ganesh Mahendran <opensource.ganesh@gmail.com>
To: "Arve Hjønnevåg" <arve@android.com>
Cc: Todd Kjos <tkjos@google.com>,
	Greg KH <gregkh@linuxfoundation.org>,
	Martijn Coenen <maco@android.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3] android: binder: use VM_ALLOC to get vm area
Date: Wed, 24 Jan 2018 13:24:47 +0800	[thread overview]
Message-ID: <CADAEsF-PwG5fNhMUpLFHmQzx7u93K9VJVQGQv5fc2CAPuvg4mg@mail.gmail.com> (raw)
In-Reply-To: <CAMP5XgfcPeW3jCCtibxO9_4p0-okva6rWK2Zw=4yD7e3un8euA@mail.gmail.com>

Hi, Arve:

2018-01-23 2:55 GMT+08:00 Arve Hjønnevåg <arve@android.com>:
> On Mon, Jan 22, 2018 at 9:02 AM, Todd Kjos <tkjos@google.com> wrote:
>> On Mon, Jan 22, 2018 at 7:54 AM, Greg KH <gregkh@linuxfoundation.org> wrote:
>>> On Wed, Jan 10, 2018 at 10:49:05AM +0800, Ganesh Mahendran wrote:
>>>> VM_IOREMAP is used to access hardware through a mechanism called
>>>> I/O mapped memory. Android binder is a IPC machanism which will
>>>> not access I/O memory.
>>>>
>>>> And VM_IOREMAP has alignment requiement which may not needed in
>>>> binder.
>>>>     __get_vm_area_node()
>>>>     {
>>>>     ...
>>>>         if (flags & VM_IOREMAP)
>>>>             align = 1ul << clamp_t(int, fls_long(size),
>>>>                PAGE_SHIFT, IOREMAP_MAX_ORDER);
>>>>     ...
>>>>     }
>>>>
>>>> This patch will save some kernel vm area, especially for 32bit os.
>>>>
>>>> In 32bit OS, kernel vm area is only 240MB. We may got below
>>>> error when launching a app:
>>>>
>>>> <3>[ 4482.440053] binder_alloc: binder_alloc_mmap_handler: 15728 8ce67000-8cf65000 get_vm_area failed -12
>>>> <3>[ 4483.218817] binder_alloc: binder_alloc_mmap_handler: 15745 8ce67000-8cf65000 get_vm_area failed -12
>>>>
>>>> Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
>>>> ----
>>>> V3: update comments
>>>> V2: update comments
>>>> ---
>>>>  drivers/android/binder_alloc.c | 2 +-
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> Martijn and Todd, any objections to this patch?
>>
>> Looks fine to me. Arve, do you remember the rationale for using VM_IOREMAP?
>>
>
> I don't remember for sure, but I think it used alloc_vm_area at some
> point, and that uses VM_IOREMAP.

Yes, in alloc_vm_area(), it uses VM_IOREMAP flag.

In binder, the ~1MB vm area is cut into binder_buffer which is not
even page aligned.
So for binder IPC, there is no need to align vm area(512KB now).
For 64 bit OS, the vm area is very big, but for 32 bit OS, default vm
area is only 240.
The vm area will soon be exhausted, then no app can be launched.

Thanks.

>
> --
> Arve Hjønnevåg

  reply	other threads:[~2018-01-24  5:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10  2:49 [PATCH v3] android: binder: use VM_ALLOC to get vm area Ganesh Mahendran
2018-01-22 15:54 ` Greg KH
2018-01-22 17:02   ` Todd Kjos
2018-01-22 18:55     ` Arve Hjønnevåg
2018-01-24  5:24       ` Ganesh Mahendran [this message]
2018-01-25  2:06     ` Ganesh Mahendran
2018-01-24 14:33   ` Martijn Coenen
2018-01-25  2:09     ` Ganesh Mahendran
2018-01-25  9:51       ` Greg KH

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=CADAEsF-PwG5fNhMUpLFHmQzx7u93K9VJVQGQv5fc2CAPuvg4mg@mail.gmail.com \
    --to=opensource.ganesh@gmail.com \
    --cc=arve@android.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maco@android.com \
    --cc=tkjos@google.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;
as well as URLs for NNTP newsgroup(s).