@ -1,3 +1,4 @@
# include <linux/binfmts.h>
# include <linux/cgroup.h>
# include <linux/err.h>
# include <linux/kernel.h>
@ -656,48 +657,40 @@ boost_write(struct cgroup_subsys_state *css, struct cftype *cft,
# ifdef CONFIG_STUNE_ASSIST
# ifdef CONFIG_SCHED_WALT
static int sched_boost_override_write_wrapper ( struct cgroup_subsys_state * css ,
struct cftype * cft , u64 override )
struct cftype * cft , u64 override )
{
if ( ! strcmp ( current - > comm , " init " ) )
if ( task_is_booster ( current ) )
return 0 ;
sched_boost_override_write ( css , NULL , override ) ;
return 0 ;
return sched_boost_override_write ( css , cft , override ) ;
}
static int sched_colocate_write_wrapper ( struct cgroup_subsys_state * css ,
struct cftype * cft , u64 colocate )
struct cftype * cft , u64 colocate )
{
if ( ! strcmp ( current - > comm , " init " ) )
if ( task_is_booster ( current ) )
return 0 ;
sched_colocate_write ( css , NULL , colocate ) ;
return 0 ;
return sched_colocate_write ( css , cft , colocate ) ;
}
# endif
static int boost_write_wrapper ( struct cgroup_subsys_state * css ,
struct cftype * cft , s64 boost )
struct cftype * cft , s64 boost )
{
if ( ! strcmp ( current - > comm , " init " ) )
if ( task_is_booster ( current ) )
return 0 ;
boost_write ( css , NULL , boost ) ;
return 0 ;
return boost_write ( css , cft , boost ) ;
}
static int prefer_idle_write_wrapper ( struct cgroup_subsys_state * css ,
struct cftype * cft , u64 prefer_idle )
struct cftype * cft , u64 prefer_idle )
{
if ( ! strcmp ( current - > comm , " init " ) )
if ( task_is_booster ( current ) )
return 0 ;
prefer_idle_write ( css , NULL , prefer_idle ) ;
return 0 ;
return prefer_idle_write ( css , cft , prefer_idle ) ;
}
# endif
@ -748,31 +741,39 @@ schedtune_boostgroup_init(struct schedtune *st)
}
# ifdef CONFIG_STUNE_ASSIST
struct st_data {
char * name ;
int boost ;
bool prefer_idle ;
bool colocate ;
bool no_override ;
} ;
static void write_default_values ( struct cgroup_subsys_state * css )
{
u8 i ;
struct groups_data {
char * name ;
int boost ;
bool prefer_idle ;
bool colocate ;
bool no_override ;
static struct st_data st_targets [ ] = {
{ " audio-app " , 0 , 0 , 0 , 0 } ,
{ " background " , 0 , 0 , 0 , 0 } ,
{ " foreground " , 0 , 1 , 0 , 1 } ,
{ " rt " , 0 , 0 , 0 , 0 } ,
{ " top-app " , 1 , 1 , 0 , 1 } ,
} ;
struct groups_data groups [ 3 ] = {
{ " top-app " , 5 , 1 , 0 , 1 } ,
{ " foreground " , 1 , 1 , 0 , 1 } ,
{ " background " , 0 , 0 , 1 , 0 } } ;
for ( i = 0 ; i < ARRAY_SIZE ( groups ) ; i + + ) {
if ( ! strcmp ( css - > cgroup - > kn - > name , groups [ i ] . name ) ) {
pr_info ( " %s: %i - %i - %i - %i \n " , groups [ i ] . name ,
groups [ i ] . boost , groups [ i ] . prefer_idle ,
groups [ i ] . colocate ,
groups [ i ] . no_override ) ;
boost_write ( css , NULL , groups [ i ] . boost ) ;
prefer_idle_write ( css , NULL , groups [ i ] . prefer_idle ) ;
sched_colocate_write ( css , NULL , groups [ i ] . colocate ) ;
sched_boost_override_write ( css , NULL , groups [ i ] . no_override ) ;
int i ;
for ( i = 0 ; i < ARRAY_SIZE ( st_targets ) ; i + + ) {
struct st_data tgt = st_targets [ i ] ;
if ( ! strcmp ( css - > cgroup - > kn - > name , tgt . name ) ) {
pr_info ( " stune_assist: setting values for %s: boost=%d prefer_idle=%d colocate=%d no_override=%d \n " ,
tgt . name , tgt . boost , tgt . prefer_idle ,
tgt . colocate , tgt . no_override ) ;
boost_write ( css , NULL , tgt . boost ) ;
prefer_idle_write ( css , NULL , tgt . prefer_idle ) ;
# ifdef CONFIG_SCHED_WALT
sched_colocate_write ( css , NULL , tgt . colocate ) ;
sched_boost_override_write ( css , NULL , tgt . no_override ) ;
# endif
}
}
}