memory barrier and atomic_t on linux

前端 未结 2 549
迷失自我
迷失自我 2020-12-16 00:35

Recently, I am reading some Linux kernel space codes, I see this

uint64_t used;
uint64_t blocked;

used = atomic64_read(&g_variable->used);       //#1         


        
2条回答
  •  一整个雨季
    2020-12-16 00:50

    x86 CPUs don’t do read-after-read reordering, so it is sufficient to prevent the compiler from doing any reordering. On other platforms such as PowerPC, things will look a lot different.

提交回复
热议问题