From 7db6632ab3e93d144ee1e62649eb996020e0c264 Mon Sep 17 00:00:00 2001 From: hujun5 Date: Tue, 11 Jun 2024 08:05:26 +0800 Subject: [PATCH] sched: irq: Change this_task to current_task(me) in restore_critical_section() this_task() is a function call that involves disabling interrupts and this_cpu(). Since restore_critical_section is always called in an interrupt-disabled context, there's no need to disable interrupts again. Therefore, to save time and achieve the same effect, I directly call tcb = current_task(me) instead of tcb = this_task(). Signed-off-by: hujun5 --- sched/irq/irq_csection.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sched/irq/irq_csection.c b/sched/irq/irq_csection.c index b5c09c96e8..224358642d 100644 --- a/sched/irq/irq_csection.c +++ b/sched/irq/irq_csection.c @@ -613,13 +613,14 @@ void restore_critical_section(void) * followed by context switching. */ - FAR struct tcb_s *tcb = this_task(); + FAR struct tcb_s *tcb; int me = this_cpu(); /* Adjust global IRQ controls. If irqcount is greater than zero, * then this task/this CPU holds the IRQ lock */ + tcb = current_task(me); if (tcb->irqcount > 0) { /* Do notihing here