blob: 7006008d5b72fbb4bde94a98fde89202bfd706a0 [file] [log] [blame]
Johannes Weinereb414682018-10-26 15:06:27 -07001#ifndef _LINUX_PSI_H
2#define _LINUX_PSI_H
3
Johannes Weinere0c27442018-11-30 14:09:58 -08004#include <linux/jump_label.h>
Johannes Weinereb414682018-10-26 15:06:27 -07005#include <linux/psi_types.h>
6#include <linux/sched.h>
7
Johannes Weiner2ce71352018-10-26 15:06:31 -07008struct seq_file;
9struct css_set;
10
Johannes Weinereb414682018-10-26 15:06:27 -070011#ifdef CONFIG_PSI
12
Johannes Weinere0c27442018-11-30 14:09:58 -080013extern struct static_key_false psi_disabled;
Johannes Weinereb414682018-10-26 15:06:27 -070014
15void psi_init(void);
16
17void psi_task_change(struct task_struct *task, int clear, int set);
18
19void psi_memstall_tick(struct task_struct *task, int cpu);
20void psi_memstall_enter(unsigned long *flags);
21void psi_memstall_leave(unsigned long *flags);
22
Johannes Weiner2ce71352018-10-26 15:06:31 -070023int psi_show(struct seq_file *s, struct psi_group *group, enum psi_res res);
24
25#ifdef CONFIG_CGROUPS
26int psi_cgroup_alloc(struct cgroup *cgrp);
27void psi_cgroup_free(struct cgroup *cgrp);
28void cgroup_move_task(struct task_struct *p, struct css_set *to);
29#endif
30
Johannes Weinereb414682018-10-26 15:06:27 -070031#else /* CONFIG_PSI */
32
33static inline void psi_init(void) {}
34
35static inline void psi_memstall_enter(unsigned long *flags) {}
36static inline void psi_memstall_leave(unsigned long *flags) {}
37
Johannes Weiner2ce71352018-10-26 15:06:31 -070038#ifdef CONFIG_CGROUPS
39static inline int psi_cgroup_alloc(struct cgroup *cgrp)
40{
41 return 0;
42}
43static inline void psi_cgroup_free(struct cgroup *cgrp)
44{
45}
46static 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 Weinereb414682018-10-26 15:06:27 -070052#endif /* CONFIG_PSI */
53
54#endif /* _LINUX_PSI_H */