sched/walt: Add per task reduce affinity feature

Create the skeleton for a per task tunable, to be used to indicate when
certain CPUs of a task should be ignored even if a task is affined to
them.

Change-Id: I8c0f1f01bbc416b5f5569dd4de1fc18971b8a5d4
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
This commit is contained in:
Shaleen Agrawal 2023-07-03 14:04:32 -07:00
parent 736a29eaf3
commit 7ba3485efe
3 changed files with 20 additions and 0 deletions

View File

@ -152,6 +152,7 @@ struct walt_task_struct {
u8 enqueue_after_migration;
u8 hung_detect_status;
int pipeline_cpu;
cpumask_t reduce_mask;
};
/*

View File

@ -277,6 +277,7 @@ enum {
LOW_LATENCY,
PIPELINE,
LOAD_BOOST,
REDUCE_AFFINITY,
};
static int sched_task_handler(struct ctl_table *table, int write,
@ -290,6 +291,8 @@ static int sched_task_handler(struct ctl_table *table, int write,
struct walt_task_struct *wts;
struct rq *rq;
struct rq_flags rf;
unsigned long bitmask;
const unsigned long *bitmaskp = &bitmask;
struct ctl_table tmp = {
.data = &pid_and_val,
@ -338,6 +341,9 @@ static int sched_task_handler(struct ctl_table *table, int write,
case LOAD_BOOST:
pid_and_val[1] = wts->load_boost;
break;
case REDUCE_AFFINITY:
pid_and_val[1] = cpumask_bits(&wts->reduce_mask)[0];
break;
default:
ret = -EINVAL;
goto put_task;
@ -437,6 +443,11 @@ static int sched_task_handler(struct ctl_table *table, int write,
else
wts->boosted_task_load = 0;
break;
case REDUCE_AFFINITY:
bitmask = (unsigned long) val;
bitmap_copy(sysctl_bitmap, bitmaskp, WALT_NR_CPUS);
cpumask_copy(&wts->reduce_mask, to_cpumask(sysctl_bitmap));
break;
default:
ret = -EINVAL;
}
@ -1085,6 +1096,13 @@ struct ctl_table walt_table[] = {
.mode = 0644,
.proc_handler = sched_task_handler,
},
{
.procname = "task_reduce_affinity",
.data = (int *) REDUCE_AFFINITY,
.maxlen = sizeof(unsigned int) * 2,
.mode = 0644,
.proc_handler = sched_task_handler,
},
{
.procname = "sched_task_read_pid",
.data = &sysctl_task_read_pid,

View File

@ -2370,6 +2370,7 @@ static inline void __sched_fork_init(struct task_struct *p)
wts->iowaited = false;
wts->load_boost = 0;
wts->boosted_task_load = 0;
wts->reduce_mask = CPU_MASK_ALL;
}
static void init_new_task_load(struct task_struct *p)