Commit a66d9724 authored by Alexey Brodkin's avatar Alexey Brodkin Committed by Greg Kroah-Hartman

devres: Align data[] to ARCH_KMALLOC_MINALIGN

Initially we bumped into problem with 32-bit aligned atomic64_t
on ARC, see [1]. And then during quite lengthly discussion Peter Z.
mentioned ARCH_KMALLOC_MINALIGN which IMHO makes perfect sense.
If allocation is done by plain kmalloc() obtained buffer will be
ARCH_KMALLOC_MINALIGN aligned and then why buffer obtained via
devm_kmalloc() should have any other alignment?

This way we at least get the same behavior for both types of

[2] Alexey Brodkin's avatarAlexey Brodkin <>
Cc: Greg Kroah-Hartman <>
Cc: Geert Uytterhoeven <>
Cc: David Laight <David.Laight@ACULAB.COM>
Cc: Peter Zijlstra <>
Cc: Thomas Gleixner <>
Cc: Vineet Gupta <>
Cc: Will Deacon <>
Cc: Greg KH <>
Cc: <> # 4.8+
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent 65102238
......@@ -26,8 +26,14 @@ struct devres_node {
struct devres {
struct devres_node node;
/* -- 3 pointers */
unsigned long long data[]; /* guarantee ull alignment */
* Some archs want to perform DMA into kmalloc caches
* and need a guaranteed alignment larger than
* the alignment of a 64-bit integer.
* Thus we use ARCH_KMALLOC_MINALIGN here and get exactly the same
* buffer alignment as if it was allocated by plain kmalloc().
u8 __aligned(ARCH_KMALLOC_MINALIGN) data[];
struct devres_group {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment