Commit | Line | Data |
---|---|---|
a6352fd4 MD |
1 | #ifndef _LIBRINGBUFFER_SMP_H |
2 | #define _LIBRINGBUFFER_SMP_H | |
3 | ||
4 | /* | |
5 | * libringbuffer/smp.h | |
6 | * | |
e92f3e28 | 7 | * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
a6352fd4 | 8 | * |
e92f3e28 MD |
9 | * This library is free software; you can redistribute it and/or |
10 | * modify it under the terms of the GNU Lesser General Public | |
11 | * License as published by the Free Software Foundation; only | |
12 | * version 2.1 of the License. | |
13 | * | |
14 | * This library is distributed in the hope that it will be useful, | |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | * Lesser General Public License for more details. | |
18 | * | |
19 | * You should have received a copy of the GNU Lesser General Public | |
20 | * License along with this library; if not, write to the Free Software | |
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
a6352fd4 MD |
22 | */ |
23 | ||
2b2d6ff7 | 24 | #include "getcpu.h" |
a6352fd4 MD |
25 | |
26 | /* | |
27 | * 4kB of per-cpu data available. Enough to hold the control structures, | |
28 | * but not ring buffers. | |
29 | */ | |
30 | #define PER_CPU_MEM_SIZE 4096 | |
31 | ||
32 | extern int __num_possible_cpus; | |
33 | extern void _get_num_possible_cpus(void); | |
34 | ||
35 | static inline | |
36 | int num_possible_cpus(void) | |
37 | { | |
38 | if (!__num_possible_cpus) | |
39 | _get_num_possible_cpus(); | |
40 | return __num_possible_cpus; | |
41 | } | |
42 | ||
a6352fd4 MD |
43 | #define for_each_possible_cpu(cpu) \ |
44 | for ((cpu) = 0; (cpu) < num_possible_cpus(); (cpu)++) | |
45 | ||
46 | #endif /* _LIBRINGBUFFER_SMP_H */ |