From 9e3b852d4b5430d93aadffe3f32b0171ab90eec6 Mon Sep 17 00:00:00 2001 From: hujun5 Date: Sat, 13 Sep 2025 17:58:35 +0800 Subject: [PATCH] seqlock: add predict_xxx to increase performance This commit added predict_xxx to increase performance. Signed-off-by: hujun5 --- include/nuttx/seqlock.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/nuttx/seqlock.h b/include/nuttx/seqlock.h index e5159816de5..a6106fbf8e7 100644 --- a/include/nuttx/seqlock.h +++ b/include/nuttx/seqlock.h @@ -102,7 +102,7 @@ unsigned int read_seqbegin(FAR const seqcount_t *s) { unsigned int seq; - while ((seq = s->sequence) & 1); + while (predict_false((seq = s->sequence) & 1)); #ifdef CONFIG_SMP UP_DMB(); @@ -137,7 +137,7 @@ unsigned int read_seqretry(FAR const seqcount_t *s, unsigned int start) #endif seq = s->sequence; - return seq != start; + return predict_false(seq != start); } /****************************************************************************