From ed3369b8ceacbfd3912728cffc33f792c0fa1c6e Mon Sep 17 00:00:00 2001 From: wanxiaoqing Date: Thu, 30 Nov 2023 12:45:26 +0800 Subject: [PATCH] disable_irq when change rt_bandwidth Signed-off-by: wanxiaoqing --- kernel/sched/rt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 0f296598a24e..5bfbabf8dbfa 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -3030,10 +3030,12 @@ static int sched_rt_global_validate(void) static void sched_rt_do_global(void) { - raw_spin_lock(&def_rt_bandwidth.rt_runtime_lock); + unsigned long flags; + + raw_spin_lock_irqsave(&def_rt_bandwidth.rt_runtime_lock, flags); def_rt_bandwidth.rt_runtime = global_rt_runtime(); def_rt_bandwidth.rt_period = ns_to_ktime(global_rt_period()); - raw_spin_unlock(&def_rt_bandwidth.rt_runtime_lock); + raw_spin_unlock_irqrestore(&def_rt_bandwidth.rt_runtime_lock, flags); } int sched_rt_handler(struct ctl_table *table, int write, void *buffer, -- Gitee