summaryrefslogtreecommitdiff
path: root/datapath/linux/compat/include/linux/percpu.h
blob: a039142e222333f8eda1afaac2fe5d65803f53e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef __LINUX_PERCPU_WRAPPER_H
#define __LINUX_PERCPU_WRAPPER_H 1

#include_next <linux/percpu.h>

#if !defined this_cpu_ptr
#define this_cpu_ptr(ptr) per_cpu_ptr(ptr, smp_processor_id())
#endif

#if !defined this_cpu_read
#define this_cpu_read(ptr) percpu_read(ptr)
#endif

#if !defined this_cpu_inc
#define this_cpu_inc(ptr) percpu_add(ptr, 1)
#endif

#if !defined this_cpu_dec
#define this_cpu_dec(ptr) percpu_sub(ptr, 1)
#endif

#ifndef alloc_percpu_gfp
#define NEED_ALLOC_PERCPU_GFP

void __percpu *__alloc_percpu_gfp(size_t size, size_t align, gfp_t gfp);

#define alloc_percpu_gfp(type, gfp)                                     \
        (typeof(type) __percpu *)__alloc_percpu_gfp(sizeof(type),       \
                                                __alignof__(type), gfp)
#endif


#endif