From dbc6bedff99426dfe23e22293eae083b91bf5e93 Mon Sep 17 00:00:00 2001 From: ouyangxiangzhen Date: Wed, 10 Sep 2025 09:36:41 +0800 Subject: [PATCH] seqlock: Remove memory barrier if Non-SMP. This commit removed unnecessary memory barriers of the seqlock implementation, since they may block the CPU pipeline and lead to performance degradation. Signed-off-by: ouyangxiangzhen --- include/nuttx/seqlock.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/nuttx/seqlock.h b/include/nuttx/seqlock.h index 2b8284e3492..e5159816de5 100644 --- a/include/nuttx/seqlock.h +++ b/include/nuttx/seqlock.h @@ -104,7 +104,10 @@ unsigned int read_seqbegin(FAR const seqcount_t *s) while ((seq = s->sequence) & 1); +#ifdef CONFIG_SMP UP_DMB(); +#endif + return seq; } @@ -129,7 +132,10 @@ unsigned int read_seqretry(FAR const seqcount_t *s, unsigned int start) { unsigned int seq; +#ifdef CONFIG_SMP UP_DMB(); +#endif + seq = s->sequence; return seq != start; }