提交 3d12fd7a 编写于 作者: Y Yunfeng Ye 提交者: Zheng Zengkai

tick/sched: Release seqcount before invoking calc_load_global()

mainline inclusion
from mainline-5.11-rc1
commit 896b969e
category: feature
feature: Deep isolation
bugzilla: https://gitee.com/openeuler/kernel/issues/I4N00D
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=896b969e6732b68ee3c12ae4e1aeddf5db99bc46

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

calc_load_global() does not need the sequence count protection.

[ tglx: Split it up properly and added comments ]
Signed-off-by: NYunfeng Ye <yeyunfeng@huawei.com>
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20201117132006.660902274@linutronix.deReviewed-by: NChao Liu <liuchao173@huawei.com>
Reviewed-by: NChen Hui <judy.chenhui@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 338b1c7a
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/sched/clock.h> #include <linux/sched/clock.h>
#include <linux/sched/stat.h> #include <linux/sched/stat.h>
#include <linux/sched/nohz.h> #include <linux/sched/nohz.h>
#include <linux/sched/loadavg.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/irq_work.h> #include <linux/irq_work.h>
#include <linux/posix-timers.h> #include <linux/posix-timers.h>
...@@ -105,7 +106,8 @@ static void tick_do_update_jiffies64(ktime_t now) ...@@ -105,7 +106,8 @@ static void tick_do_update_jiffies64(ktime_t now)
tick_period); tick_period);
} }
do_timer(ticks); /* Advance jiffies to complete the jiffies_seq protected job */
jiffies_64 += ticks;
/* /*
* Keep the tick_next_period variable up to date. WRITE_ONCE() * Keep the tick_next_period variable up to date. WRITE_ONCE()
...@@ -114,7 +116,15 @@ static void tick_do_update_jiffies64(ktime_t now) ...@@ -114,7 +116,15 @@ static void tick_do_update_jiffies64(ktime_t now)
WRITE_ONCE(tick_next_period, WRITE_ONCE(tick_next_period,
ktime_add(last_jiffies_update, tick_period)); ktime_add(last_jiffies_update, tick_period));
/*
* Release the sequence count. calc_global_load() below is not
* protected by it, but jiffies_lock needs to be held to prevent
* concurrent invocations.
*/
write_seqcount_end(&jiffies_seq); write_seqcount_end(&jiffies_seq);
calc_global_load();
raw_spin_unlock(&jiffies_lock); raw_spin_unlock(&jiffies_lock);
update_wall_time(); update_wall_time();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册