Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LINUX_PSI_H
0003 #define _LINUX_PSI_H
0004 
0005 #include <linux/jump_label.h>
0006 #include <linux/psi_types.h>
0007 #include <linux/sched.h>
0008 #include <linux/poll.h>
0009 #include <linux/cgroup-defs.h>
0010 
0011 struct seq_file;
0012 struct css_set;
0013 
0014 #ifdef CONFIG_PSI
0015 
0016 extern struct static_key_false psi_disabled;
0017 extern struct psi_group psi_system;
0018 
0019 void psi_init(void);
0020 
0021 void psi_task_change(struct task_struct *task, int clear, int set);
0022 void psi_task_switch(struct task_struct *prev, struct task_struct *next,
0023              bool sleep);
0024 
0025 void psi_memstall_enter(unsigned long *flags);
0026 void psi_memstall_leave(unsigned long *flags);
0027 
0028 int psi_show(struct seq_file *s, struct psi_group *group, enum psi_res res);
0029 struct psi_trigger *psi_trigger_create(struct psi_group *group,
0030             char *buf, enum psi_res res);
0031 void psi_trigger_destroy(struct psi_trigger *t);
0032 
0033 __poll_t psi_trigger_poll(void **trigger_ptr, struct file *file,
0034             poll_table *wait);
0035 
0036 #ifdef CONFIG_CGROUPS
0037 int psi_cgroup_alloc(struct cgroup *cgrp);
0038 void psi_cgroup_free(struct cgroup *cgrp);
0039 void cgroup_move_task(struct task_struct *p, struct css_set *to);
0040 #endif
0041 
0042 #else /* CONFIG_PSI */
0043 
0044 static inline void psi_init(void) {}
0045 
0046 static inline void psi_memstall_enter(unsigned long *flags) {}
0047 static inline void psi_memstall_leave(unsigned long *flags) {}
0048 
0049 #ifdef CONFIG_CGROUPS
0050 static inline int psi_cgroup_alloc(struct cgroup *cgrp)
0051 {
0052     return 0;
0053 }
0054 static inline void psi_cgroup_free(struct cgroup *cgrp)
0055 {
0056 }
0057 static inline void cgroup_move_task(struct task_struct *p, struct css_set *to)
0058 {
0059     rcu_assign_pointer(p->cgroups, to);
0060 }
0061 #endif
0062 
0063 #endif /* CONFIG_PSI */
0064 
0065 #endif /* _LINUX_PSI_H */