lkml.org 
[lkml]   [2018]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: block: DMA alignment of IO buffer allocated from slab
On Mon, 24 Sep 2018, Bart Van Assche wrote:

> /*
> * kmalloc and friends return ARCH_KMALLOC_MINALIGN aligned
> * pointers. kmem_cache_alloc and friends return ARCH_SLAB_MINALIGN
> * aligned pointers.
> */

kmalloc alignment is only guaranteed to ARCH_KMALLOC_MINALIGN. That power
of 2 byte caches (without certain options) are aligned to the power of 2
is due to the nature that these objects are stored in SLUB. Other
allocators may behave different and actually different debug options
result in different alignments. You cannot rely on that.

ARCH_KMALLOC minalign shows the mininum alignment guarantees. If that is
not sufficient and you do not want to change the arch guarantees then you
can open you own slab cache with kmem_cache_create() where you can specify
different alignment requirements.

\
 
 \ /
  Last update: 2018-09-24 17:18    [W:0.076 / U:1.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site