Clean up alloc_percpu: add align argument to __alloc_percpu.
Subsystems (4)
PATCH 2/3 Clean up alloc_percpu: add align argument to __alloc_percpu.
This prepares for a real __alloc_percpu, by adding an alignment argument. Currently there are two files which use this, so fix them up too.
Signed-off-by Rusty Russell <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc Jens Axboe <[email protected]>
--- block/blktrace.c | 2 +- include/linux/percpu.h | 5 +++-- net/ipv4/af_inet.c | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-)
block/blktrace.c +1 -1
@@ -389,7 +389,7 @@if (!bt->sequence) goto err; - bt->msg_data =__alloc_percpu (BLK_TN_MAX_MSG ); + bt->msg_data =__alloc_percpu (BLK_TN_MAX_MSG , __alignof__(char ));if (!bt->msg_data) goto err;
include/linux/percpu.h +3 -2
@@ -112,9 +112,10 @@/* (legacy) interface for use without CPU hotplug handling */ -#define __alloc_percpu (size) percpu_alloc_mask((size), GFP_KERNEL, \ +#define __alloc_percpu (size, align) percpu_alloc_mask((size), GFP_KERNEL, \ cpu_possible_map) -#define alloc_percpu (type) (type *)__alloc_percpu(sizeof(type)) +#define alloc_percpu (type) (type *)__alloc_percpu(sizeof(type), \ + __alignof__(type))#define free_percpu (ptr) percpu_free((ptr))#define per_cpu_ptr (ptr, cpu) percpu_ptr((ptr), (cpu))
net/ipv4/af_inet.c +2 -2
@@ -1283,10 +1283,10 @@int snmp_mib_init (void *ptr[2 ],size_t mibsize) {BUG_ON (ptr ==NULL ); - ptr[0 ] =__alloc_percpu (mibsize); + ptr[0 ] =__alloc_percpu (mibsize, __alignof__(unsigned long ));if (!ptr[0 ]) goto err0; - ptr[1 ] =__alloc_percpu (mibsize); + ptr[1 ] =__alloc_percpu (mibsize, __alignof__(unsigned long ));if (!ptr[1 ]) goto err1;return 0 ;