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,
27 char *buf, enum psi_res res, struct file *file);
28 void psi_trigger_destroy(struct psi_trigger *t);
30 __poll_t psi_trigger_poll(void **trigger_ptr, struct file *file,
34 static inline struct psi_group *cgroup_psi(struct cgroup *cgrp)
36 return cgroup_ino(cgrp) == 1 ? &psi_system : cgrp->psi;
39 int psi_cgroup_alloc(struct cgroup *cgrp);
40 void psi_cgroup_free(struct cgroup *cgrp);
41 void cgroup_move_task(struct task_struct *p, struct css_set *to);
42 void psi_cgroup_restart(struct psi_group *group);
45 #else /* CONFIG_PSI */
47 static inline void psi_init(void) {}
49 static inline void psi_memstall_enter(unsigned long *flags) {}
50 static inline void psi_memstall_leave(unsigned long *flags) {}
53 static inline int psi_cgroup_alloc(struct cgroup *cgrp)
57 static inline void psi_cgroup_free(struct cgroup *cgrp)
60 static inline void cgroup_move_task(struct task_struct *p, struct css_set *to)
62 rcu_assign_pointer(p->cgroups, to);
64 static inline void psi_cgroup_restart(struct psi_group *group) {}
67 #endif /* CONFIG_PSI */
69 #endif /* _LINUX_PSI_H */