From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752314AbeAXFYt (ORCPT ); Wed, 24 Jan 2018 00:24:49 -0500 Received: from mail-it0-f65.google.com ([209.85.214.65]:37536 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751081AbeAXFYs (ORCPT ); Wed, 24 Jan 2018 00:24:48 -0500 X-Google-Smtp-Source: AH8x226QVA+rGXZm8AmyM5HWzmF8QDM3l0DnFkKK2JyBOrK5ePuQZXmSS7MsEiVGI1h0EJqDqAVMMAnLEU8XP9J/q1c= MIME-Version: 1.0 In-Reply-To: References: <1515552545-18311-1-git-send-email-opensource.ganesh@gmail.com> <20180122155428.GB7714@kroah.com> From: Ganesh Mahendran Date: Wed, 24 Jan 2018 13:24:47 +0800 Message-ID: Subject: Re: [PATCH v3] android: binder: use VM_ALLOC to get vm area To: =?UTF-8?B?QXJ2ZSBIasO4bm5ldsOlZw==?= Cc: Todd Kjos , Greg KH , Martijn Coenen , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id w0O5OuiU012281 Hi, Arve: 2018-01-23 2:55 GMT+08:00 Arve Hjønnevåg : > On Mon, Jan 22, 2018 at 9:02 AM, Todd Kjos wrote: >> On Mon, Jan 22, 2018 at 7:54 AM, Greg KH 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 >>>> ---- >>>> 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