1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/jump_label.h>
6 #include <linux/psi_types.h>
7 #include <linux/sched.h>
8 #include <linux/poll.h>
9 #include <linux/cgroup-defs.h>
10 #include <linux/cgroup.h>
17 extern struct static_key_false psi_disabled;
18 extern struct psi_group psi_system;
22 void psi_memstall_enter(unsigned long *flags);
23 void psi_memstall_leave(unsigned long *flags);
25 int psi_show(struct seq_file *s, struct psi_group *group, enum psi_res res);
26 struct psi_trigger *psi_trigger_create(struct psi_group *group, char *buf,
27 enum psi_res res, struct file *file,
28 struct kernfs_open_file *of);
29 void psi_trigger_destroy(struct psi_trigger *t);
31 __poll_t psi_trigger_poll(void **trigger_ptr, struct file *file,
35 static inline struct psi_group *cgroup_psi(struct cgroup *cgrp)
37 return cgroup_ino(cgrp) == 1 ? &psi_system : cgrp->psi;
40 int psi_cgroup_alloc(struct cgroup *cgrp);
41 void psi_cgroup_free(struct cgroup *cgrp);
42 void cgroup_move_task(struct task_struct *p, struct css_set *to);
43 void psi_cgroup_restart(struct psi_group *group);
46 #else /* CONFIG_PSI */
48 static inline void psi_init(void) {}
50 static inline void psi_memstall_enter(unsigned long *flags) {}
51 static inline void psi_memstall_leave(unsigned long *flags) {}
54 static inline int psi_cgroup_alloc(struct cgroup *cgrp)
58 static inline void psi_cgroup_free(struct cgroup *cgrp)
61 static inline void cgroup_move_task(struct task_struct *p, struct css_set *to)
63 rcu_assign_pointer(p->cgroups, to);
65 static inline void psi_cgroup_restart(struct psi_group *group) {}
68 #endif /* CONFIG_PSI */
70 #endif /* _LINUX_PSI_H */