Commit | Line | Data |
---|---|---|
a6352fd4 | 1 | /* |
c0c0989a | 2 | * SPDX-License-Identifier: LGPL-2.1-only |
a6352fd4 | 3 | * |
e92f3e28 | 4 | * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
a6352fd4 MD |
5 | */ |
6 | ||
c0c0989a MJ |
7 | #ifndef _LIBRINGBUFFER_SMP_H |
8 | #define _LIBRINGBUFFER_SMP_H | |
9 | ||
247c2ecd | 10 | #include "lib/lttng-ust/getcpu.h" |
a6352fd4 MD |
11 | |
12 | /* | |
13 | * 4kB of per-cpu data available. Enough to hold the control structures, | |
14 | * but not ring buffers. | |
15 | */ | |
16 | #define PER_CPU_MEM_SIZE 4096 | |
17 | ||
1d18d519 MJ |
18 | extern int __num_possible_cpus |
19 | __attribute__((visibility("hidden"))); | |
ddabe860 | 20 | |
1d18d519 MJ |
21 | extern void _get_num_possible_cpus(void) |
22 | __attribute__((visibility("hidden"))); | |
a6352fd4 MD |
23 | |
24 | static inline | |
25 | int num_possible_cpus(void) | |
26 | { | |
27 | if (!__num_possible_cpus) | |
28 | _get_num_possible_cpus(); | |
29 | return __num_possible_cpus; | |
30 | } | |
31 | ||
a6352fd4 MD |
32 | #define for_each_possible_cpu(cpu) \ |
33 | for ((cpu) = 0; (cpu) < num_possible_cpus(); (cpu)++) | |
34 | ||
35 | #endif /* _LIBRINGBUFFER_SMP_H */ |