Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pvector: Use acquire-release semantics for size.
Read/write concurrency of pvector library is implemented by a temp vector and RCU protection. Considering performance reason, insertion does not follow this scheme. In insertion function, a thread fence ensures size increment is done after new entry is stored. But there is no barrier in the iteration fuction(pvector_cursor_init). Entry point access may be reordered before loading vector size, so the invalid entry point may be loaded when vector iteration. This patch fixes it by acquire-release pair. It can guarantee new size is observed by reader after new entry stored by writer. And this is implemented by one-way barrier instead of two-way memory fence. Fixes: fe7cfa5 ("lib/pvector: Non-intrusive RCU priority vector.") Reviewed-by: Gavin Hu <Gavin.Hu@arm.com> Reviewed-by: Lijian Zhang <Lijian.Zhang@arm.com> Signed-off-by: Yanqin Wei <Yanqin.Wei@arm.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
- Loading branch information
Showing
2 changed files
with
20 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters