psi.h 1.6 KB

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