Johannes Weiner | eb41468 | 2018-10-26 15:06:27 -0700 | [diff] [blame] | 1 | #ifndef _LINUX_PSI_H |
| 2 | #define _LINUX_PSI_H |
| 3 | |
| 4 | #include <linux/psi_types.h> |
| 5 | #include <linux/sched.h> |
| 6 | |
Johannes Weiner | 2ce7135 | 2018-10-26 15:06:31 -0700 | [diff] [blame] | 7 | struct seq_file; |
| 8 | struct css_set; |
| 9 | |
Johannes Weiner | eb41468 | 2018-10-26 15:06:27 -0700 | [diff] [blame] | 10 | #ifdef CONFIG_PSI |
| 11 | |
| 12 | extern bool psi_disabled; |
| 13 | |
| 14 | void psi_init(void); |
| 15 | |
| 16 | void psi_task_change(struct task_struct *task, int clear, int set); |
| 17 | |
| 18 | void psi_memstall_tick(struct task_struct *task, int cpu); |
| 19 | void psi_memstall_enter(unsigned long *flags); |
| 20 | void psi_memstall_leave(unsigned long *flags); |
| 21 | |
Johannes Weiner | 2ce7135 | 2018-10-26 15:06:31 -0700 | [diff] [blame] | 22 | int psi_show(struct seq_file *s, struct psi_group *group, enum psi_res res); |
| 23 | |
| 24 | #ifdef CONFIG_CGROUPS |
| 25 | int psi_cgroup_alloc(struct cgroup *cgrp); |
| 26 | void psi_cgroup_free(struct cgroup *cgrp); |
| 27 | void cgroup_move_task(struct task_struct *p, struct css_set *to); |
| 28 | #endif |
| 29 | |
Johannes Weiner | eb41468 | 2018-10-26 15:06:27 -0700 | [diff] [blame] | 30 | #else /* CONFIG_PSI */ |
| 31 | |
| 32 | static inline void psi_init(void) {} |
| 33 | |
| 34 | static inline void psi_memstall_enter(unsigned long *flags) {} |
| 35 | static inline void psi_memstall_leave(unsigned long *flags) {} |
| 36 | |
Johannes Weiner | 2ce7135 | 2018-10-26 15:06:31 -0700 | [diff] [blame] | 37 | #ifdef CONFIG_CGROUPS |
| 38 | static inline int psi_cgroup_alloc(struct cgroup *cgrp) |
| 39 | { |
| 40 | return 0; |
| 41 | } |
| 42 | static inline void psi_cgroup_free(struct cgroup *cgrp) |
| 43 | { |
| 44 | } |
| 45 | static inline void cgroup_move_task(struct task_struct *p, struct css_set *to) |
| 46 | { |
| 47 | rcu_assign_pointer(p->cgroups, to); |
| 48 | } |
| 49 | #endif |
| 50 | |
Johannes Weiner | eb41468 | 2018-10-26 15:06:27 -0700 | [diff] [blame] | 51 | #endif /* CONFIG_PSI */ |
| 52 | |
| 53 | #endif /* _LINUX_PSI_H */ |