#ifndef _LINUX_CONTEXT_TRACKING_STATE_H#define _LINUX_CONTEXT_TRACKING_STATE_H#include <linux/percpu.h>#include <linux/static_key.h>structcontext_tracking{/* * When active is false, probes are unset in order * to minimize overhead: TIF flags are cleared * and calls to user_enter/exit are ignored. This * may be further optimized using static keys. */boolactive;enumctx_state{IN_KERNEL=0,IN_USER,}state;};#ifdef CONFIG_CONTEXT_TRACKINGexternstructstatic_keycontext_tracking_enabled;DECLARE_PER_CPU(structcontext_tracking,context_tracking);staticinlineboolcontext_tracking_in_user(void){return__this_cpu_read(context_tracking.state)==IN_USER;}staticinlineboolcontext_tracking_active(void){return__this_cpu_read(context_tracking.active);}#elsestaticinlineboolcontext_tracking_in_user(void){returnfalse;}staticinlineboolcontext_tracking_active(void){returnfalse;}#endif /* CONFIG_CONTEXT_TRACKING */#endif