@ -25,6 +25,7 @@ struct sugov_tunables {
struct gov_attr_set attr_set ;
unsigned int up_rate_limit_us ;
unsigned int down_rate_limit_us ;
bool iowait_boost_enable ;
} ;
struct sugov_policy {
@ -238,6 +239,11 @@ static void sugov_get_util(unsigned long *util, unsigned long *max, int cpu)
static void sugov_set_iowait_boost ( struct sugov_cpu * sg_cpu , u64 time ,
unsigned int flags )
{
struct sugov_policy * sg_policy = sg_cpu - > sg_policy ;
if ( ! sg_policy - > tunables - > iowait_boost_enable )
return ;
if ( flags & SCHED_CPUFREQ_IOWAIT ) {
if ( sg_cpu - > iowait_boost_pending )
return ;
@ -534,12 +540,35 @@ static ssize_t down_rate_limit_us_store(struct gov_attr_set *attr_set,
return count ;
}
static ssize_t iowait_boost_enable_show ( struct gov_attr_set * attr_set ,
char * buf )
{
struct sugov_tunables * tunables = to_sugov_tunables ( attr_set ) ;
return snprintf ( buf , PAGE_SIZE , " %u \n " ,
tunables - > iowait_boost_enable ) ;
}
static ssize_t iowait_boost_enable_store ( struct gov_attr_set * attr_set ,
const char * buf , size_t count )
{
struct sugov_tunables * tunables = to_sugov_tunables ( attr_set ) ;
bool enable ;
if ( kstrtobool ( buf , & enable ) )
return - EINVAL ;
tunables - > iowait_boost_enable = enable ;
return count ;
}
static struct governor_attr up_rate_limit_us = __ATTR_RW ( up_rate_limit_us ) ;
static struct governor_attr down_rate_limit_us = __ATTR_RW ( down_rate_limit_us ) ;
static struct governor_attr iowait_boost_enable =
__ATTR_RW ( iowait_boost_enable ) ;
static struct attribute * sugov_attributes [ ] = {
& up_rate_limit_us . attr ,
& down_rate_limit_us . attr ,
& iowait_boost_enable . attr ,
NULL
} ;
@ -726,6 +755,7 @@ static int sugov_init(struct cpufreq_policy *policy)
cpufreq_policy_transition_delay_us ( policy ) ;
tunables - > down_rate_limit_us =
cpufreq_policy_transition_delay_us ( policy ) ;
tunables - > iowait_boost_enable = false ;
policy - > governor_data = sg_policy ;
sg_policy - > tunables = tunables ;