Memory ordering and usage of ASM cmpxchg() instead of compiler atomic intrinsics

Change-Id: I4dadebc32721744dad982f3fc5b3eea7ab7ca745
This commit is contained in:
Balazs Gerofi
2019-08-13 15:17:07 +09:00
committed by Masamichi Takagi
parent 7aa2d64294
commit c3c57940ba
4 changed files with 30 additions and 26 deletions

View File

@@ -587,8 +587,7 @@ static int fileobj_get_page(struct memobj *memobj, off_t off,
/* Update the array but see if someone did it already and use
* that if so */
if (!__sync_bool_compare_and_swap(&memobj->pages[page_ind],
NULL, virt)) {
if (cmpxchg(&memobj->pages[page_ind], NULL, virt) != NULL) {
ihk_mc_free_pages_user(virt, 1);
}
else {