From patchwork Thu Jul 14 21:10:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Corbet X-Patchwork-Id: 975782 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6ELAmrL009457 for ; Thu, 14 Jul 2011 21:10:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932160Ab1GNVKq (ORCPT ); Thu, 14 Jul 2011 17:10:46 -0400 Received: from tex.lwn.net ([70.33.254.29]:36824 "EHLO vena.lwn.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754455Ab1GNVKq (ORCPT ); Thu, 14 Jul 2011 17:10:46 -0400 Received: from bike.lwn.net (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by vena.lwn.net (Postfix) with ESMTP id 8975D1540047; Thu, 14 Jul 2011 15:10:45 -0600 (MDT) Date: Thu, 14 Jul 2011 15:10:44 -0600 From: Jonathan Corbet To: linux-media@vger.kernel.org, Mauro Carvalho Chehab Cc: Marek Szyprowski Subject: [PATCH] videobuf2: Do not unconditionally map S/G buffers into kernel space Message-ID: <20110714151044.44cb89ee@bike.lwn.net> Organization: LWN.net X-Mailer: Claws Mail 3.7.9 (GTK+ 2.24.5; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 14 Jul 2011 21:10:48 +0000 (UTC) The one in-tree videobuf2-dma-sg driver (mmp-camera) has no need for a kernel-space mapping of the buffers; one suspects that most other drivers would not either. The videobuf2-dma-sg module does the right thing if buf->vaddr == NULL - it maps the buffer on demand if somebody needs it. So let's not map the buffer at allocation time; that will save a little CPU time and a lot of address space in the vmalloc range. Signed-off-by: Jonathan Corbet Acked-by: Marek Szyprowski --- drivers/media/video/videobuf2-dma-sg.c | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-) diff --git a/drivers/media/video/videobuf2-dma-sg.c b/drivers/media/video/videobuf2-dma-sg.c index b2d9485..0e8edc1 100644 --- a/drivers/media/video/videobuf2-dma-sg.c +++ b/drivers/media/video/videobuf2-dma-sg.c @@ -77,12 +77,6 @@ static void *vb2_dma_sg_alloc(void *alloc_ctx, unsigned long size) printk(KERN_DEBUG "%s: Allocated buffer of %d pages\n", __func__, buf->sg_desc.num_pages); - - if (!buf->vaddr) - buf->vaddr = vm_map_ram(buf->pages, - buf->sg_desc.num_pages, - -1, - PAGE_KERNEL); return buf; fail_pages_alloc: