[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171019151214.GD24204@lst.de>
Date: Thu, 19 Oct 2017 17:12:14 +0200
From: Christoph Hellwig <hch@....de>
To: Marek Szyprowski <m.szyprowski@...sung.com>
Cc: Huacai Chen <chenhc@...ote.com>, Christoph Hellwig <hch@....de>,
Robin Murphy <robin.murphy@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
Fuxin Zhang <zhangfx@...ote.com>, linux-kernel@...r.kernel.org,
Ralf Baechle <ralf@...ux-mips.org>,
James Hogan <james.hogan@...tec.com>,
linux-mips@...ux-mips.org,
"James E . J . Bottomley" <jejb@...ux.vnet.ibm.com>,
"Martin K . Petersen" <martin.petersen@...cle.com>,
linux-scsi@...r.kernel.org, Tejun Heo <tj@...nel.org>,
linux-ide@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH V8 4/5] libsas: Align SMP req/resp to
dma_get_cache_alignment()
On Tue, Oct 17, 2017 at 01:55:43PM +0200, Marek Szyprowski wrote:
> If I remember correctly, kernel guarantees that each kmalloced buffer is
> always at least aligned to the CPU cache line, so CPU cache can be
> invalidated on the allocated buffer without corrupting anything else.
Yes, from slab.h:
/*
* Some archs want to perform DMA into kmalloc caches and need a guaranteed
* alignment larger than the alignment of a 64-bit integer.
* Setting ARCH_KMALLOC_MINALIGN in arch headers allows that.
*/
#if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8
#define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN
#define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN
#define KMALLOC_SHIFT_LOW ilog2(ARCH_DMA_MINALIGN)
#else
#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
#endif
Mips sets this for a few subarchitectures, but it seems like you need
to set it for yours as well.
Powered by blists - more mailing lists