cregit-Linux how code gets into the kernel

Release 4.12 include/linux/context_tracking_state.h

Directory: include/linux
#ifndef _LINUX_CONTEXT_TRACKING_STATE_H

#define _LINUX_CONTEXT_TRACKING_STATE_H

#include <linux/percpu.h>
#include <linux/static_key.h>


struct context_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.
         */
	
bool active;
	
int recursion;
	
enum ctx_state {
		
CONTEXT_DISABLED = -1,	/* returned by ct_state() if unknown */
		
CONTEXT_KERNEL = 0,
		
CONTEXT_USER,
		
CONTEXT_GUEST,
        } 
state;
};

#ifdef CONFIG_CONTEXT_TRACKING
extern struct static_key_false context_tracking_enabled;
DECLARE_PER_CPU(struct context_tracking, context_tracking);


static inline bool context_tracking_is_enabled(void) { return static_branch_unlikely(&context_tracking_enabled); }

Contributors

PersonTokensPropCommitsCommitProp
Frédéric Weisbecker1593.75%150.00%
Andrew Lutomirski16.25%150.00%
Total16100.00%2100.00%


static inline bool context_tracking_cpu_is_enabled(void) { return __this_cpu_read(context_tracking.active); }

Contributors

PersonTokensPropCommitsCommitProp
Frédéric Weisbecker17100.00%2100.00%
Total17100.00%2100.00%


static inline bool context_tracking_in_user(void) { return __this_cpu_read(context_tracking.state) == CONTEXT_USER; }

Contributors

PersonTokensPropCommitsCommitProp
Frédéric Weisbecker19100.00%3100.00%
Total19100.00%3100.00%

#else
static inline bool context_tracking_in_user(void) { return false; }

Contributors

PersonTokensPropCommitsCommitProp
Frédéric Weisbecker12100.00%1100.00%
Total12100.00%1100.00%


static inline bool context_tracking_active(void) { return false; }

Contributors

PersonTokensPropCommitsCommitProp
Frédéric Weisbecker12100.00%1100.00%
Total12100.00%1100.00%


static inline bool context_tracking_is_enabled(void) { return false; }

Contributors

PersonTokensPropCommitsCommitProp
Rik Van Riel12100.00%1100.00%
Total12100.00%1100.00%


static inline bool context_tracking_cpu_is_enabled(void) { return false; }

Contributors

PersonTokensPropCommitsCommitProp
Rik Van Riel12100.00%1100.00%
Total12100.00%1100.00%

#endif /* CONFIG_CONTEXT_TRACKING */ #endif

Overall Contributors

PersonTokensPropCommitsCommitProp
Frédéric Weisbecker13279.52%555.56%
Rik Van Riel2615.66%222.22%
Andrew Lutomirski84.82%222.22%
Total166100.00%9100.00%
Directory: include/linux
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.