mirror of
https://github.com/apache/nuttx.git
synced 2026-08-04 22:00:21 +00: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:
parent
f1ef43c72e
commit
dbc6bedff9
1 changed files with 6 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue