headers/prep: Fix header to build standalone: <linux/psi.h>
[linux-block.git] / include / linux / psi.h
CommitLineData
2fb75e1b 1/* SPDX-License-Identifier: GPL-2.0 */
eb414681
JW
2#ifndef _LINUX_PSI_H
3#define _LINUX_PSI_H
4
e0c27447 5#include <linux/jump_label.h>
eb414681
JW
6#include <linux/psi_types.h>
7#include <linux/sched.h>
0e94682b 8#include <linux/poll.h>
3387ce4d 9#include <linux/cgroup-defs.h>
eb414681 10
2ce7135a
JW
11struct seq_file;
12struct css_set;
13
eb414681
JW
14#ifdef CONFIG_PSI
15
e0c27447 16extern struct static_key_false psi_disabled;
df5ba5be 17extern struct psi_group psi_system;
eb414681
JW
18
19void psi_init(void);
20
21void psi_task_change(struct task_struct *task, int clear, int set);
36b238d5
JW
22void psi_task_switch(struct task_struct *prev, struct task_struct *next,
23 bool sleep);
eb414681 24
eb414681
JW
25void psi_memstall_enter(unsigned long *flags);
26void psi_memstall_leave(unsigned long *flags);
27
2ce7135a 28int psi_show(struct seq_file *s, struct psi_group *group, enum psi_res res);
0e94682b
SB
29struct psi_trigger *psi_trigger_create(struct psi_group *group,
30 char *buf, size_t nbytes, enum psi_res res);
a06247c6 31void psi_trigger_destroy(struct psi_trigger *t);
0e94682b
SB
32
33__poll_t psi_trigger_poll(void **trigger_ptr, struct file *file,
34 poll_table *wait);
51e50fbd
SB
35
36#ifdef CONFIG_CGROUPS
37int psi_cgroup_alloc(struct cgroup *cgrp);
38void psi_cgroup_free(struct cgroup *cgrp);
39void cgroup_move_task(struct task_struct *p, struct css_set *to);
2ce7135a
JW
40#endif
41
eb414681
JW
42#else /* CONFIG_PSI */
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
2ce7135a
JW
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
eb414681
JW
63#endif /* CONFIG_PSI */
64
65#endif /* _LINUX_PSI_H */