提交 b171c3e6 编写于 作者: X Xie XiuQi

sched/cputime: add cmdline account_irqtime_to_task

hulk inclusion
category: bugfix
bugzilla: 13257
CVE: NA

Product team don't want to account irqtime to task.
They want to show the cpu usage to customers as before.

In this patch we add a cmdline option, which is determined by
the product team to turn it on or off.
Signed-off-by: NXie XiuQi <xiexiuqi@huawei.com>
Reviewed-by: NCheng Jian <cj.chengjian@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 4445f2dd
...@@ -129,6 +129,14 @@ struct rq *task_rq_lock(struct task_struct *p, struct rq_flags *rf) ...@@ -129,6 +129,14 @@ struct rq *task_rq_lock(struct task_struct *p, struct rq_flags *rf)
/* /*
* RQ-clock updating methods: * RQ-clock updating methods:
*/ */
bool account_irqtime_to_task __read_mostly;
static int __init setup_account_irqtime(char *str)
{
account_irqtime_to_task = true;
return 0;
}
__setup("account-irqtime-to-task", setup_account_irqtime);
static void update_rq_clock_task(struct rq *rq, s64 delta) static void update_rq_clock_task(struct rq *rq, s64 delta)
{ {
...@@ -139,6 +147,9 @@ static void update_rq_clock_task(struct rq *rq, s64 delta) ...@@ -139,6 +147,9 @@ static void update_rq_clock_task(struct rq *rq, s64 delta)
s64 __maybe_unused steal = 0, irq_delta = 0; s64 __maybe_unused steal = 0, irq_delta = 0;
#ifdef CONFIG_IRQ_TIME_ACCOUNTING #ifdef CONFIG_IRQ_TIME_ACCOUNTING
if (account_irqtime_to_task)
goto out;
irq_delta = irq_time_read(cpu_of(rq)) - rq->prev_irq_time; irq_delta = irq_time_read(cpu_of(rq)) - rq->prev_irq_time;
/* /*
...@@ -161,6 +172,8 @@ static void update_rq_clock_task(struct rq *rq, s64 delta) ...@@ -161,6 +172,8 @@ static void update_rq_clock_task(struct rq *rq, s64 delta)
rq->prev_irq_time += irq_delta; rq->prev_irq_time += irq_delta;
delta -= irq_delta; delta -= irq_delta;
out:
#endif #endif
#ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING #ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING
if (static_key_false((&paravirt_steal_rq_enabled))) { if (static_key_false((&paravirt_steal_rq_enabled))) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册