blob: 8e0725aac0aa82fc45997ca21bddfb40a431a9ab [file] [log] [blame]
Johannes Weinereb414682018-10-26 15:06:27 -07001#ifndef _LINUX_PSI_H
2#define _LINUX_PSI_H
3
4#include <linux/psi_types.h>
5#include <linux/sched.h>
6
Johannes Weiner2ce71352018-10-26 15:06:31 -07007struct seq_file;
8struct css_set;
9
Johannes Weinereb414682018-10-26 15:06:27 -070010#ifdef CONFIG_PSI
11
12extern bool psi_disabled;
13
14void psi_init(void);
15
16void psi_task_change(struct task_struct *task, int clear, int set);
17
18void psi_memstall_tick(struct task_struct *task, int cpu);
19void psi_memstall_enter(unsigned long *flags);
20void psi_memstall_leave(unsigned long *flags);
21
Johannes Weiner2ce71352018-10-26 15:06:31 -070022int psi_show(struct seq_file *s, struct psi_group *group, enum psi_res res);
23
24#ifdef CONFIG_CGROUPS
25int psi_cgroup_alloc(struct cgroup *cgrp);
26void psi_cgroup_free(struct cgroup *cgrp);
27void cgroup_move_task(struct task_struct *p, struct css_set *to);
28#endif
29
Johannes Weinereb414682018-10-26 15:06:27 -070030#else /* CONFIG_PSI */
31
32static inline void psi_init(void) {}
33
34static inline void psi_memstall_enter(unsigned long *flags) {}
35static inline void psi_memstall_leave(unsigned long *flags) {}
36
Johannes Weiner2ce71352018-10-26 15:06:31 -070037#ifdef CONFIG_CGROUPS
38static inline int psi_cgroup_alloc(struct cgroup *cgrp)
39{
40 return 0;
41}
42static inline void psi_cgroup_free(struct cgroup *cgrp)
43{
44}
45static 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 Weinereb414682018-10-26 15:06:27 -070051#endif /* CONFIG_PSI */
52
53#endif /* _LINUX_PSI_H */