mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 14:27:37 +08:00
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 <ouyangxiangzhen@xiaomi.com>
This commit is contained in:
committed by
Alan C. Assis
parent
f1ef43c72e
commit
dbc6bedff9
@@ -104,7 +104,10 @@ unsigned int read_seqbegin(FAR const seqcount_t *s)
|
|||||||
|
|
||||||
while ((seq = s->sequence) & 1);
|
while ((seq = s->sequence) & 1);
|
||||||
|
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
UP_DMB();
|
UP_DMB();
|
||||||
|
#endif
|
||||||
|
|
||||||
return seq;
|
return seq;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,7 +132,10 @@ unsigned int read_seqretry(FAR const seqcount_t *s, unsigned int start)
|
|||||||
{
|
{
|
||||||
unsigned int seq;
|
unsigned int seq;
|
||||||
|
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
UP_DMB();
|
UP_DMB();
|
||||||
|
#endif
|
||||||
|
|
||||||
seq = s->sequence;
|
seq = s->sequence;
|
||||||
return seq != start;
|
return seq != start;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user