cpufreq.h 983 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _LINUX_SCHED_CPUFREQ_H
  3. #define _LINUX_SCHED_CPUFREQ_H
  4. #include <linux/types.h>
  5. /*
  6. * Interface between cpufreq drivers and the scheduler:
  7. */
  8. #define SCHED_CPUFREQ_IOWAIT (1U << 0)
  9. #ifdef CONFIG_CPU_FREQ
  10. struct cpufreq_policy;
  11. struct update_util_data {
  12. void (*func)(struct update_util_data *data, u64 time, unsigned int flags);
  13. };
  14. void cpufreq_add_update_util_hook(int cpu, struct update_util_data *data,
  15. void (*func)(struct update_util_data *data, u64 time,
  16. unsigned int flags));
  17. void cpufreq_remove_update_util_hook(int cpu);
  18. bool cpufreq_this_cpu_can_update(struct cpufreq_policy *policy);
  19. static inline unsigned long map_util_freq(unsigned long util,
  20. unsigned long freq, unsigned long cap)
  21. {
  22. return freq * util / cap;
  23. }
  24. static inline unsigned long map_util_perf(unsigned long util)
  25. {
  26. return util + (util >> 2);
  27. }
  28. #endif /* CONFIG_CPU_FREQ */
  29. #endif /* _LINUX_SCHED_CPUFREQ_H */