From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753981Ab0EKWdz (ORCPT ); Tue, 11 May 2010 18:33:55 -0400 Received: from earthlight.etchedpixels.co.uk ([81.2.110.250]:39674 "EHLO www.etchedpixels.co.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753581Ab0EKWdx (ORCPT ); Tue, 11 May 2010 18:33:53 -0400 Date: Tue, 11 May 2010 23:37:42 +0100 From: Alan Cox To: Mike Frysinger Cc: Christoph Lameter , Pekka Enberg , Matt Mackall , Dmitry Torokhov , Andrew Morton , Oskar Schirmer , Michael Hennerich , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Daniel =?ISO-8859-14?B?R2z2Y2tuZXI=?= , Oliver Schneidewind , Johannes Weiner , Nick Piggin , David Rientjes , David Brownell , Grant Likely Subject: Re: [PATCH v3] ad7877: keep dma rx buffers in seperate cache lines Message-ID: <20100511233742.61cf0a6b@lxorguk.ukuu.org.uk> In-Reply-To: References: <1273487642-2169-1-git-send-email-os@emlix.com> <20100511062110.GB9644@core.coreip.homeip.net> <20100511063309.GC9644@core.coreip.homeip.net> <1273608441.15067.1002.camel@calx> X-Mailer: Claws Mail 3.7.5 (GTK+ 2.18.9; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > SPI transfer into a DMA safe buffer. what is the exact API to > dynamically allocate memory for the structure with this buffer > embedded in it such that the start of the structure is cached aligned > ? creating a dedicated kmem cache may work, but it isnt a scalable > solution if every SPI driver needs to create its own cache. If you are embedding structures then one solution is to cheat a bit and make the structure, compiler and existing kernel compile abuse do the work. Something like struct { void *except_where_prohibited; long boat; unsigned photograph; u8 pad[0] __cacheline_aligned; }.. ought to do the trick providing you align the start of the object - which should happen naturally with kmalloc or dma_* apis