Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LINUX_SCHED_CPUFREQ_H
0003 #define _LINUX_SCHED_CPUFREQ_H
0004 
0005 #include <linux/types.h>
0006 
0007 /*
0008  * Interface between cpufreq drivers and the scheduler:
0009  */
0010 
0011 #define SCHED_CPUFREQ_IOWAIT    (1U << 0)
0012 
0013 #ifdef CONFIG_CPU_FREQ
0014 struct cpufreq_policy;
0015 
0016 struct update_util_data {
0017        void (*func)(struct update_util_data *data, u64 time, unsigned int flags);
0018 };
0019 
0020 void cpufreq_add_update_util_hook(int cpu, struct update_util_data *data,
0021                        void (*func)(struct update_util_data *data, u64 time,
0022                     unsigned int flags));
0023 void cpufreq_remove_update_util_hook(int cpu);
0024 bool cpufreq_this_cpu_can_update(struct cpufreq_policy *policy);
0025 
0026 static inline unsigned long map_util_freq(unsigned long util,
0027                     unsigned long freq, unsigned long cap)
0028 {
0029     return freq * util / cap;
0030 }
0031 
0032 static inline unsigned long map_util_perf(unsigned long util)
0033 {
0034     return util + (util >> 2);
0035 }
0036 #endif /* CONFIG_CPU_FREQ */
0037 
0038 #endif /* _LINUX_SCHED_CPUFREQ_H */