Messages in this thread | | | Date | Tue, 30 Nov 2021 16:26:09 +0100 (CET) | From | Christoph Lameter <> | Subject | Re: [PATCH v4] slob: add size header to all allocations |
| |
On Tue, 30 Nov 2021, Vlastimil Babka wrote:
> So either I missed something or we violate the rule that kmalloc() provides > blocks where ARCH_KMALLOC_MINALIGN is not just the alignment of their > beginning but also nothing else touches the N*ARCH_KMALLOC_MINALIGN area > containing the allocated object.
Indeed.... The DMA API documentation in the kernel states:
Documentation/DMA-API-HOWTO.rst
2) ARCH_KMALLOC_MINALIGN
+ Architectures must ensure that kmalloc'ed buffer is + DMA-safe. Drivers and subsystems depend on it. If an architecture + isn't fully DMA-coherent (i.e. hardware doesn't ensure that data in + the CPU cache is identical to data in main memory), + ARCH_KMALLOC_MINALIGN must be set so that the memory allocator + makes sure that kmalloc'ed buffer doesn't share a cache line with + the others. See arch/arm/include/asm/cache.h as an example.
Note that this is only the case for kmalloc. Not for a slab cache setup separately from the kmalloc array. That is why ARCH_KMALLOC_MINALIGN exists.
| |