提交 8090ab77 编写于 作者: G Guan Jing 提交者: Zheng Zengkai

sched: Add tracepoint for qos smt expeller

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I52611
CVE: NA

--------------------------------

There are two caces that we add tracepoint:
a) while online task of sibling cpu is running, it is running
that offline task of local cpu will be set TIF_NEED_RESCHED;
b) while online task of sibling cpu is running, it will expell
that next picked offline task of local cpu.
Signed-off-by: NGuan Jing <guanjing6@huawei.com>
Reviewed-by: NChen Hui <judy.chenhui@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 42f42fee
......@@ -183,6 +183,61 @@ TRACE_EVENT(sched_switch,
__entry->next_comm, __entry->next_pid, __entry->next_prio)
);
#ifdef CONFIG_QOS_SCHED_SMT_EXPELLER
/*
* Tracepoint for a offline task being resched:
*/
TRACE_EVENT(sched_qos_smt_expel,
TP_PROTO(struct task_struct *sibling_p, int qos_smt_status),
TP_ARGS(sibling_p, qos_smt_status),
TP_STRUCT__entry(
__array( char, sibling_comm, TASK_COMM_LEN )
__field( pid_t, sibling_pid )
__field( int, sibling_qos_status )
__field( int, sibling_cpu )
),
TP_fast_assign(
memcpy(__entry->sibling_comm, sibling_p->comm, TASK_COMM_LEN);
__entry->sibling_pid = sibling_p->pid;
__entry->sibling_qos_status = qos_smt_status;
__entry->sibling_cpu = task_cpu(sibling_p);
),
TP_printk("sibling_comm=%s sibling_pid=%d sibling_qos_status=%d sibling_cpu=%d",
__entry->sibling_comm, __entry->sibling_pid, __entry->sibling_qos_status,
__entry->sibling_cpu)
);
/*
* Tracepoint for a offline task being expelled:
*/
TRACE_EVENT(sched_qos_smt_expelled,
TP_PROTO(struct task_struct *p, int qos_smt_status),
TP_ARGS(p, qos_smt_status),
TP_STRUCT__entry(
__array( char, comm, TASK_COMM_LEN )
__field( pid_t, pid )
__field( int, qos_status )
),
TP_fast_assign(
memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
__entry->pid = p->pid;
__entry->qos_status = qos_smt_status;
),
TP_printk("comm=%s pid=%d qos_status=%d",
__entry->comm, __entry->pid, __entry->qos_status)
);
#endif
/*
* Tracepoint for a task being migrated:
*/
......
......@@ -7485,12 +7485,16 @@ static bool _qos_smt_check_need_resched(int this_cpu, struct rq *rq)
* and current cpu only has SCHED_IDLE tasks enqueued.
*/
if (per_cpu(qos_smt_status, cpu) == QOS_LEVEL_ONLINE &&
task_group(current)->qos_level < QOS_LEVEL_ONLINE)
task_group(current)->qos_level < QOS_LEVEL_ONLINE) {
trace_sched_qos_smt_expel(cpu_curr(cpu), per_cpu(qos_smt_status, cpu));
return true;
}
if (per_cpu(qos_smt_status, cpu) == QOS_LEVEL_OFFLINE &&
rq->curr == rq->idle && sched_idle_cpu(this_cpu))
rq->curr == rq->idle && sched_idle_cpu(this_cpu)) {
trace_sched_qos_smt_expel(cpu_curr(cpu), per_cpu(qos_smt_status, cpu));
return true;
}
}
return false;
......@@ -7528,6 +7532,7 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf
if (qos_smt_expelled(this_cpu)) {
__this_cpu_write(qos_smt_status, QOS_LEVEL_OFFLINE);
schedstat_inc(rq->curr->se.statistics.nr_qos_smt_expelled);
trace_sched_qos_smt_expelled(rq->curr, per_cpu(qos_smt_status, this_cpu));
return NULL;
}
#endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册