File: cpu.h

package info (click to toggle)
lttng-modules 2.14.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,808 kB
  • sloc: ansic: 74,851; sh: 548; makefile: 62
file content (44 lines) | stat: -rw-r--r-- 794 bytes parent folder | download | duplicates (3)
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
34
35
36
37
38
39
40
41
42
43
44
/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
 *
 * wrapper/cpu.h
 *
 * Copyright (C) 2021 Michael Jeanson <mjeanson@efficios.com>
 */

#ifndef _LTTNG_WRAPPER_CPU_H
#define _LTTNG_WRAPPER_CPU_H

#include <linux/cpu.h>
#include <lttng/kernel-version.h>

#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,13,0))

static inline
void lttng_cpus_read_lock(void)
{
	cpus_read_lock();
}

static inline
void lttng_cpus_read_unlock(void)
{
	cpus_read_unlock();
}

#else /* LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,13,0) */

static inline
void lttng_cpus_read_lock(void)
{
	get_online_cpus();
}

static inline
void lttng_cpus_read_unlock(void)
{
	put_online_cpus();
}

#endif /* LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,13,0) */

#endif /* _LTTNG_WRAPPER_CPU_H */