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