Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3024293imj; Mon, 11 Feb 2019 12:29:48 -0800 (PST) X-Google-Smtp-Source: AHgI3IbJm1FfMalWGKsHOsslaV4zyIFIaCNl+l1qJ+vNR1DCcZGVpsYk/ixrQ8Yt51AHPVOyKNn+ X-Received: by 2002:a62:5444:: with SMTP id i65mr34372pfb.193.1549916988111; Mon, 11 Feb 2019 12:29:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549916988; cv=none; d=google.com; s=arc-20160816; b=U/Llmg7nkY+hSIq37c/9zVv+py0TThY9vmNOm9jVqWa8JKMnZp7nhcrq3SYwSzyXaV x04mIIn23/aqtq4fxQxZVMCt9eqOkkyk6J4BhPVe4oOerZ/BSbrxsBmYzOfiiMEu/8Bw 4ZnCrzTz4wQpdcEkeCjwyV5ChdcfB+dyEodLLbD09fnNoBViaTgFB3tHEsM5kUK9Teqp PgZlwRn1u37oWQUq0IdkXpP1Pktap9oN1Nwwe0RibJlGiWt4dJ8oOtx1OFc6Nse/pMyA FdrAoYpbfZB5gjEd3iCQWl1d8o8HsG/KSVumY26O3fEkTHIUnnCUZPC/AXASMYD3eGm7 FSRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=/epyN4S3As8DhEjdK3otcl/1yvaoHTQZrUBJfybiyLY=; b=xZU+eYr3LWR0SvLHICqMp4xDfZD30TLLzj9kvVsU3IAqMC+LrSNm1WOPPr9jiH8ylv dGkS7rQRS3AGJoZc99bVXWZqeAEjVRQwaCW6eOxnkph0Ard6rlzG9pYiodGZ11tl69wN zMiA+XzomDaek6+nVHp+2Icn/6v2LIZAFDB0f4jnVZGNodK4dJ5rx01v29NPeVImPAK/ bHq9GaDW2CvEvhxkKaxxsLXxECbggOkzbN6PVs3bzLpGqNrSyvpSCcOh0UXxCBrYUIXu ep13RMbyMT2CNmZETOf11fU8j7EdjsKjduP3olQrSW/ab1YKyT7f4ImfJwSgtlVvVDMT rzMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=P6p+VoXM; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b23si4648975pgl.559.2019.02.11.12.29.32; Mon, 11 Feb 2019 12:29:48 -0800 (PST) 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; dkim=pass header.i=@google.com header.s=20161025 header.b=P6p+VoXM; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729282AbfBKRIy (ORCPT + 99 others); Mon, 11 Feb 2019 12:08:54 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:44185 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727809AbfBKRIx (ORCPT ); Mon, 11 Feb 2019 12:08:53 -0500 Received: by mail-lj1-f194.google.com with SMTP id a16so5318604ljb.11 for ; Mon, 11 Feb 2019 09:08:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/epyN4S3As8DhEjdK3otcl/1yvaoHTQZrUBJfybiyLY=; b=P6p+VoXMjCWAfyGR+8ESjjNMYs//hvEgWQts/M+hB8aQyP7Z2A6ud0vRdPFRJ+VzYy cTCYZ+zRIV+f0MRS8rR/w2lcWtRE0F69M8fU/oxtet28hW5lUAD6/0Hf3BnzWHB+Zyfb ZLKpcTDBfA1zjxd02CJTvZbTv7K/HGfUteS3CYoDxDm16YvG7f6FBMA6vQngbpySpCqR 5N406+j/ShWCWja1gPj3pDGYOlhh/jFdBnu3LXYkTMlEylVjd9IV+3CWDVJDao3vEPBh wi0BY8nrSJH+Kl46Mnzsh1lNfyktRPvQiMzWDKUZuX70SneFJTL/+7nMXE/xxVHdxb3u dIow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/epyN4S3As8DhEjdK3otcl/1yvaoHTQZrUBJfybiyLY=; b=Gvdp6RoBsOAWNYeGT8TcoyUpH/agrCaNyd3745OFX52Evi9mjJ+5KtuCnnFuf3XDuj k5bprRs0EWKAmn9M0B47yi0bvPRn9qYsCQWBOjyugUgNp+prLb8S/ypj4/lGjFvgg7IW ZMBED57EaccxLrwqmOGIg11ld5cZXhTlP/ID3bzlQ2U5oYfGUg0Z3tN6JFmUCHkeOMnj Bm8pPbahD9SHrgXuA/ZSn8844za7T2AH1q7EK6WOrAzBamiV3/jbwuPh0zRP9feuRKpo N1K3SVJ3Z+0Qu0rxFpqmZQQ2FqlCfvuCQkgCU9136iWzH1HkR+UXqvVf42pZJ7num5Vg z0bA== X-Gm-Message-State: AHQUAua4+i9lMZIqps7dO9cD1OYvTCoDeHXMHlL6e9G0O0kbEBeccZ0n nJMGPXqwmtwy0ZEojJtLb8/b6tLkKNiqhBva2kptgw== X-Received: by 2002:a2e:9457:: with SMTP id o23-v6mr22131446ljh.7.1549904931531; Mon, 11 Feb 2019 09:08:51 -0800 (PST) MIME-Version: 1.0 References: <20190208183520.30886-1-tkjos@google.com> <20190211165708.GA25685@infradead.org> In-Reply-To: <20190211165708.GA25685@infradead.org> From: Todd Kjos Date: Mon, 11 Feb 2019 09:08:40 -0800 Message-ID: Subject: Re: [PATCH v3 0/7] binder: eliminate use of vmalloc space for binder buffers To: Christoph Hellwig Cc: Todd Kjos , Greg Kroah-Hartman , =?UTF-8?B?QXJ2ZSBIasO4bm5ldsOlZw==?= , "open list:ANDROID DRIVERS" , LKML , Martijn Coenen , joel@joelfernandes.org, Android Kernel Team Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 11, 2019 at 8:57 AM Christoph Hellwig wrote: > > On Fri, Feb 08, 2019 at 10:35:13AM -0800, Todd Kjos wrote: > > Binder buffers have always been mapped into kernel space > > via map_kernel_range_noflush() to allow the binder driver > > to modify the buffer before posting to userspace for > > processing. > > > > In recent Android releases, the number of long-running > > binder processes has increased to the point that for > > 32-bit systems, there is a risk of running out of > > vmalloc space. > > > > This patch set removes the persistent mapping of the > > binder buffers into kernel space. Instead, the binder > > driver creates temporary mappings with kmap() or > > kmap_atomic() to copy to or from the buffer only when > > necessary. > > Is there any good reason to actually map the user memory to kernel > space instead of just using copy_{to,from}_user? Yes, the mappings are needed for cases where we are accessing binder buffers of the target while in sender context. For example, we copy the message from the sender to the target with 1 copy while in the sender's context. For this we use copy_from_user(), but use these temporary mappings for the destination (target process). -Todd