Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2255429imm; Thu, 7 Jun 2018 07:47:15 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJDg+UA1XcbTuKK4n4oXnAzCKGfX83+cKc0m/nSvgSMucChyCIMUvTE3B5qFJluCdFbeJsx X-Received: by 2002:a17:902:1c7:: with SMTP id b65-v6mr2369937plb.298.1528382835211; Thu, 07 Jun 2018 07:47:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528382835; cv=none; d=google.com; s=arc-20160816; b=ocyGV22nlyQ4KAJkPfCJUcqBcC/Yboj0HeBvFvn1rpWBbOkt1bbZ6TPOuEhkjjrqXa 4um+pS4ITqkpTmnJ3dBRVI4He8XXa8wiF4GLtelStHBAGQlYYlFIzxwR5LnIoSDPKA5E QKNEI5J0nDzA1RQngHGHnpOk4+E2563Rg9OMsl1PIKmh99/qlAASanJZ7bu9UGiOeFVB f8du2nIP0O890fZnvP02m03T3+HRpZGAzs7Wl9YWtGSM+3BcVgB0wr/GktR1CwdNfrIv rC16tKDDlzGV8J1bBeDponAugkTHBW72Q/CCnk+fFSj2f7Fiz87uTjnXKqMOl4ne3xzG Pn2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=GsosOi+28JnybczalfEXMLrs9xd+KVNIl4s9Vob3Ykg=; b=iNJBTXmZHLT2gI6AzV5CTShPBmKdvIV9tkn6B+ae8aKqma/39dQMRHnxhSxdfm2IK0 mC/KAoOM4w+rIUDACVBm6amtNQT2WtYa44KtT+mJeNC+IJc3Ptotdywdw4LzmA7JgXYa TewGfdHcih8D99mo4hv1pooC7jtAcvJMNTqda9eYGHYcoMGBpICnrcwI3BbFWPpBrYrk HvNIDSNkhlNDkFnRCadnu248v0US9Q4nlqMmAfTZwl46biOrxvNoQ/6t9pdX3T7XeqDF jopSg14BAsfWsf6HoaghrwIv/XOXKOFKrgdfjuJfNNf1vH7d0dk25Qm4ifjXx2o9nALl 84DA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 32-v6si54215051plc.252.2018.06.07.07.47.00; Thu, 07 Jun 2018 07:47:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934697AbeFGOqR (ORCPT + 99 others); Thu, 7 Jun 2018 10:46:17 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:40756 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934982AbeFGOqL (ORCPT ); Thu, 7 Jun 2018 10:46:11 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvbm-0005Zl-66; Thu, 07 Jun 2018 15:09:46 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvb4-0002ws-9y; Thu, 07 Jun 2018 15:09:02 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Greg Kroah-Hartman" , "Ganesh Mahendran" , "Todd Kjos" , "Martijn Coenen" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 168/410] android: binder: use VM_ALLOC to get vm area In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.57-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Ganesh Mahendran commit aac6830ec1cb681544212838911cdc57f2638216 upstream. 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 Acked-by: Martijn Coenen Acked-by: Todd Kjos ---- V3: update comments V2: update comments Signed-off-by: Greg Kroah-Hartman [bwh: Backported to 3.16: adjust filename] Signed-off-by: Ben Hutchings --- drivers/staging/android/binder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/staging/android/binder.c +++ b/drivers/staging/android/binder.c @@ -2808,7 +2808,7 @@ static int binder_mmap(struct file *filp goto err_already_mapped; } - area = get_vm_area(vma->vm_end - vma->vm_start, VM_IOREMAP); + area = get_vm_area(vma->vm_end - vma->vm_start, VM_ALLOC); if (area == NULL) { ret = -ENOMEM; failure_string = "get_vm_area";