提交 57804174 编写于 作者: Y Yihao Wu 提交者: Caspar Zhang

alinux: Fix latency histogram & nr_migrations rcu bugs

to #29558346

rcu variable can be NULL inside rcu lock region, if rcu_read_lock is
called in grace period. So check if (!variable) before dereference it.
Signed-off-by: NYihao Wu <wuyihao@linux.alibaba.com>
Acked-by: NShanpei Chen <shanpeic@linux.alibaba.com>
上级 cd40824f
...@@ -247,6 +247,7 @@ void task_ca_increase_nr_migrations(struct task_struct *tsk) ...@@ -247,6 +247,7 @@ void task_ca_increase_nr_migrations(struct task_struct *tsk)
rcu_read_lock(); rcu_read_lock();
ca = task_ca(tsk); ca = task_ca(tsk);
if (ca)
this_cpu_ptr(ca->alistats)->nr_migrations++; this_cpu_ptr(ca->alistats)->nr_migrations++;
rcu_read_unlock(); rcu_read_unlock();
} }
...@@ -263,6 +264,10 @@ void task_ca_update_block(struct task_struct *tsk, u64 runtime) ...@@ -263,6 +264,10 @@ void task_ca_update_block(struct task_struct *tsk, u64 runtime)
rcu_read_lock(); rcu_read_lock();
ca = task_ca(tsk); ca = task_ca(tsk);
if (!ca) {
rcu_read_unlock();
return;
}
if (tsk->in_iowait) if (tsk->in_iowait)
s = SCHED_LAT_IOBLOCK; s = SCHED_LAT_IOBLOCK;
else else
...@@ -290,6 +295,10 @@ void cpuacct_update_latency(struct sched_entity *se, u64 delta) ...@@ -290,6 +295,10 @@ void cpuacct_update_latency(struct sched_entity *se, u64 delta)
rcu_read_lock(); rcu_read_lock();
tg = se->cfs_rq->tg; tg = se->cfs_rq->tg;
ca = cgroup_ca(tg->css.cgroup); ca = cgroup_ca(tg->css.cgroup);
if (!ca) {
rcu_read_unlock();
return;
}
if (entity_is_task(se)) if (entity_is_task(se))
s = SCHED_LAT_WAIT; s = SCHED_LAT_WAIT;
else else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册