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 */
|