From be28f1768f065d58bf0b70c4ffa9db013bd2ffa1 Mon Sep 17 00:00:00 2001 From: Maximilian Schuele Date: Wed, 23 Oct 2019 18:33:01 +0200 Subject: [PATCH 1/2] fix with ambiguous abs --- src/local_request.cc | 4 ++-- src/remote_request.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/local_request.cc b/src/local_request.cc index 0cb1b771..064607c3 100644 --- a/src/local_request.cc +++ b/src/local_request.cc @@ -125,7 +125,7 @@ int Worker::ProcessLocalMalloc(WorkRequest* wr) { wr->addr = TO_GLOB(addr, base, GetWorkerId()); wr->status = SUCCESS; ghost_size += wr->size; - if (abs(ghost_size.load()) > conf->ghost_th) + if (labs(ghost_size.load()) > conf->ghost_th) SyncMaster(); } else { wr->status = ALLOC_ERROR; @@ -159,7 +159,7 @@ int Worker::ProcessLocalFree(WorkRequest* wr) { void* addr = ToLocal(wr->addr); Size size = sb.sb_free(addr); ghost_size -= size; - if (abs(ghost_size.load()) > conf->ghost_th) + if (labs(ghost_size.load()) > conf->ghost_th) SyncMaster(); } else { Client* cli = GetClient(wr->addr); diff --git a/src/remote_request.cc b/src/remote_request.cc index f7676d86..e10db9d4 100644 --- a/src/remote_request.cc +++ b/src/remote_request.cc @@ -255,7 +255,7 @@ void Worker::ProcessRequest(Client* client, WorkRequest* wr) { epicAssert(IsLocal(wr->addr)); Size size = sb.sb_free(ToLocal(wr->addr)); ghost_size -= size; - if (abs(ghost_size.load()) > conf->ghost_th) + if (labs(ghost_size.load()) > conf->ghost_th) SyncMaster(); delete wr; wr = nullptr; From 2d830216845181c76535ce5e28aef52924311273 Mon Sep 17 00:00:00 2001 From: Maximilian Schuele Date: Wed, 23 Oct 2019 18:33:13 +0200 Subject: [PATCH 2/2] fix with thread local variable --- include/util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/util.h b/include/util.h index 23096b08..9f5b22a5 100644 --- a/include/util.h +++ b/include/util.h @@ -51,7 +51,7 @@ uint64_t rdtsc(); #define atomic_read(v) __sync_fetch_and_add((v), (0)) inline int GetRandom(int min, int max) { - static __thread unsigned int tid = (unsigned int) syscall(SYS_gettid); + static thread_local unsigned int tid = (unsigned int) syscall(SYS_gettid); epicLog(LOG_DEBUG, "tid = %d", tid); int ret = (rand_r(&tid) % (max - min)) + min; return ret;