at v5.14 1.6 kB view raw
1#ifndef _LINUX_PSI_H 2#define _LINUX_PSI_H 3 4#include <linux/jump_label.h> 5#include <linux/psi_types.h> 6#include <linux/sched.h> 7#include <linux/poll.h> 8 9struct seq_file; 10struct css_set; 11 12#ifdef CONFIG_PSI 13 14extern struct static_key_false psi_disabled; 15extern struct psi_group psi_system; 16 17void psi_init(void); 18 19void psi_task_change(struct task_struct *task, int clear, int set); 20void psi_task_switch(struct task_struct *prev, struct task_struct *next, 21 bool sleep); 22 23void psi_memstall_enter(unsigned long *flags); 24void psi_memstall_leave(unsigned long *flags); 25 26int psi_show(struct seq_file *s, struct psi_group *group, enum psi_res res); 27 28#ifdef CONFIG_CGROUPS 29int psi_cgroup_alloc(struct cgroup *cgrp); 30void psi_cgroup_free(struct cgroup *cgrp); 31void cgroup_move_task(struct task_struct *p, struct css_set *to); 32 33struct psi_trigger *psi_trigger_create(struct psi_group *group, 34 char *buf, size_t nbytes, enum psi_res res); 35void psi_trigger_replace(void **trigger_ptr, struct psi_trigger *t); 36 37__poll_t psi_trigger_poll(void **trigger_ptr, struct file *file, 38 poll_table *wait); 39#endif 40 41#else /* CONFIG_PSI */ 42 43static inline void psi_init(void) {} 44 45static inline void psi_memstall_enter(unsigned long *flags) {} 46static inline void psi_memstall_leave(unsigned long *flags) {} 47 48#ifdef CONFIG_CGROUPS 49static inline int psi_cgroup_alloc(struct cgroup *cgrp) 50{ 51 return 0; 52} 53static inline void psi_cgroup_free(struct cgroup *cgrp) 54{ 55} 56static inline void cgroup_move_task(struct task_struct *p, struct css_set *to) 57{ 58 rcu_assign_pointer(p->cgroups, to); 59} 60#endif 61 62#endif /* CONFIG_PSI */ 63 64#endif /* _LINUX_PSI_H */