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