X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=urcu-bp.c;h=9c7da3d8d235355246de95dfb5de87c8dcc1fec8;hb=288b842166255327245cb4e8a05ea34b79504e04;hp=cbdebf407a892c2d201d42d948025723702414e7;hpb=e44dd88adfc9a89b6cd7393163bc0d680d292f4d;p=userspace-rcu.git diff --git a/urcu-bp.c b/urcu-bp.c index cbdebf4..9c7da3d 100644 --- a/urcu-bp.c +++ b/urcu-bp.c @@ -373,7 +373,8 @@ void expand_arena(struct registry_arena *arena) sizeof(struct registry_chunk) + sizeof(struct rcu_reader)); new_chunk_len = ARENA_INIT_ALLOC; - new_chunk = mmap(NULL, new_chunk_len, + new_chunk = (struct registry_chunk *) mmap(NULL, + new_chunk_len, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); @@ -407,7 +408,8 @@ void expand_arena(struct registry_arena *arena) } /* Remap did not succeed, we need to add a new chunk. */ - new_chunk = mmap(NULL, new_chunk_len, + new_chunk = (struct registry_chunk *) mmap(NULL, + new_chunk_len, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); @@ -579,6 +581,17 @@ void urcu_bp_thread_exit_notifier(void *rcu_key) rcu_bp_unregister(rcu_key); } +static +void rcu_sys_membarrier_status(int available) +{ + /* + * membarrier has blocking behavior, which changes the + * application behavior too much compared to using barriers when + * synchronize_rcu is used repeatedly (without using call_rcu). + * Don't use membarrier for now. + */ +} + static void rcu_bp_init(void) { @@ -591,9 +604,8 @@ void rcu_bp_init(void) if (ret) abort(); ret = membarrier(MEMBARRIER_CMD_QUERY, 0); - if (ret >= 0 && (ret & MEMBARRIER_CMD_SHARED)) { - urcu_bp_has_sys_membarrier = 1; - } + rcu_sys_membarrier_status(ret >= 0 + && (ret & MEMBARRIER_CMD_SHARED)); initialized = 1; } mutex_unlock(&init_lock); @@ -609,7 +621,7 @@ void rcu_bp_exit(void) cds_list_for_each_entry_safe(chunk, tmp, ®istry_arena.chunk_list, node) { - munmap(chunk, chunk->data_len + munmap((void *) chunk, chunk->data_len + sizeof(struct registry_chunk)); } CDS_INIT_LIST_HEAD(®istry_arena.chunk_list);