seqlock: add predict_xxx to increase performance

This commit added predict_xxx to increase performance.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5
2025-09-13 17:58:35 +08:00
committed by Alan C. Assis
parent dbc6bedff9
commit 9e3b852d4b
+2 -2
View File
@@ -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);
}
/****************************************************************************