From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753578Ab1GFOwK (ORCPT ); Wed, 6 Jul 2011 10:52:10 -0400 Received: from moutng.kundenserver.de ([212.227.17.9]:54297 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753473Ab1GFOwH (ORCPT ); Wed, 6 Jul 2011 10:52:07 -0400 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 6/8] drivers: add Contiguous Memory Allocator Date: Wed, 6 Jul 2011 16:51:49 +0200 User-Agent: KMail/1.12.2 (Linux/2.6.37; KDE/4.3.2; x86_64; ; ) Cc: "Russell King - ARM Linux" , "'Daniel Walker'" , "'Jonathan Corbet'" , "'Mel Gorman'" , "'Chunsang Jeong'" , "'Jesse Barker'" , "'KAMEZAWA Hiroyuki'" , linux-kernel@vger.kernel.org, "'Michal Nazarewicz'" , linaro-mm-sig@lists.linaro.org, linux-mm@kvack.org, "'Kyungmin Park'" , "'Ankita Garg'" , "'Andrew Morton'" , Marek Szyprowski , linux-media@vger.kernel.org References: <1309851710-3828-1-git-send-email-m.szyprowski@samsung.com> <201107061609.29996.arnd@arndb.de> <20110706142345.GC8286@n2100.arm.linux.org.uk> In-Reply-To: <20110706142345.GC8286@n2100.arm.linux.org.uk> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201107061651.49824.arnd@arndb.de> X-Provags-ID: V02:K0:9Xb85dGcUOYifW2YZ5D6qFxmwYbRSiVnlOIlYR5v3ZV befsy5A8Dlv8if3PoOtHggQyU8VkrRGOdpjf8hJs3v1BZrp5wY WTHuGYC5WsF6dZgV6BK5d0fL68/ioAFdEUd2wqHa4P6jWU/PGO 0VZKTMkOyrwKMXGJAM+ELDDxHIQrFf1qKTGNvgneQlAjUjvFQM QDNMh19p3lLpkcqc77stA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday 06 July 2011, Russell King - ARM Linux wrote: > On Wed, Jul 06, 2011 at 04:09:29PM +0200, Arnd Bergmann wrote: > > Maybe you can simply adapt the default location of the contiguous memory > > are like this: > > - make CONFIG_CMA depend on CONFIG_HIGHMEM on ARM, at compile time > > - if ZONE_HIGHMEM exist during boot, put the CMA area in there > > - otherwise, put the CMA area at the top end of lowmem, and change > > the zone sizes so ZONE_HIGHMEM stretches over all of the CMA memory. > > One of the requirements of the allocator is that the returned memory > should be zero'd (because it can be exposed to userspace via ALSA > and frame buffers.) > > Zeroing the memory from all the contexts which dma_alloc_coherent > is called from is a trivial matter if its in lowmem, but highmem is > harder. I don't see how. The pages get allocated from an unmapped area or memory, mapped into the kernel address space as uncached or wc and then cleared. This should be the same for lowmem or highmem pages. What am I missing? > Another issue is that when a platform has restricted DMA regions, > they typically don't fall into the highmem zone. As the dmabounce > code allocates from the DMA coherent allocator to provide it with > guaranteed DMA-able memory, that would be rather inconvenient. True. The dmabounce code would consequently have to allocate the memory through an internal function that avoids the contiguous allocation area and goes straight to ZONE_DMA memory as it does today. Arnd