Commit | Line | Data |
---|---|---|
a6352fd4 MD |
1 | #ifndef _LIBRINGBUFFER_SMP_H |
2 | #define _LIBRINGBUFFER_SMP_H | |
3 | ||
4 | /* | |
5 | * libringbuffer/smp.h | |
6 | * | |
7 | * Copyright 2011 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
8 | * | |
9 | * Dual LGPL v2.1/GPL v2 license. | |
10 | */ | |
11 | ||
2b2d6ff7 | 12 | #include "getcpu.h" |
a6352fd4 MD |
13 | |
14 | /* | |
15 | * 4kB of per-cpu data available. Enough to hold the control structures, | |
16 | * but not ring buffers. | |
17 | */ | |
18 | #define PER_CPU_MEM_SIZE 4096 | |
19 | ||
20 | extern int __num_possible_cpus; | |
21 | extern void _get_num_possible_cpus(void); | |
22 | ||
23 | static inline | |
24 | int num_possible_cpus(void) | |
25 | { | |
26 | if (!__num_possible_cpus) | |
27 | _get_num_possible_cpus(); | |
28 | return __num_possible_cpus; | |
29 | } | |
30 | ||
a6352fd4 MD |
31 | #define for_each_possible_cpu(cpu) \ |
32 | for ((cpu) = 0; (cpu) < num_possible_cpus(); (cpu)++) | |
33 | ||
34 | #endif /* _LIBRINGBUFFER_SMP_H */ |