sched/addrenv: replace critical section with spinlock for refs protection
Build Documentation / build-html (push) Has been cancelled

Replace global enter_critical_section() calls with lightweight spinlock in
addrenv_switch() to reduce interrupt latency, and convert refs counter to
atomic_t for thread-safe reference counting without blocking operations.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5
2025-03-09 16:05:05 +08:00
committed by Xiang Xiao
parent d19ee93c60
commit 2c1e3d6ed0
2 changed files with 6 additions and 4 deletions
+2 -1
View File
@@ -38,6 +38,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <nuttx/atomic.h>
#include <nuttx/wqueue.h>
#include <arch/arch.h>
@@ -264,7 +265,7 @@ struct addrenv_s
{
struct arch_addrenv_s addrenv; /* The address environment page directory */
struct work_s work; /* Worker to free address environment */
int refs; /* Users of address environment */
atomic_t refs; /* Users of address environment */
};
typedef struct addrenv_s addrenv_t;