From 6b0c7c6d0618330be932ab28efd025d29a902c51 Mon Sep 17 00:00:00 2001 From: fengruilin Date: Mon, 8 Oct 2018 16:06:43 +0800 Subject: [PATCH] optimize thread lock on mips64 --- common_mips64.h | 2 +- driver/others/memory.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common_mips64.h b/common_mips64.h index 93bc7e519..1163413dc 100644 --- a/common_mips64.h +++ b/common_mips64.h @@ -94,7 +94,7 @@ static inline unsigned int rpcc(void){ #define RPCC_DEFINED #ifndef NO_AFFINITY -#define WHEREAMI +//#define WHEREAMI static inline int WhereAmI(void){ int ret=0; __asm__ __volatile__(".set push \n" diff --git a/driver/others/memory.c b/driver/others/memory.c index 0019253c0..4a8e6c067 100644 --- a/driver/others/memory.c +++ b/driver/others/memory.c @@ -2587,20 +2587,20 @@ void *blas_memory_alloc(int procpos){ position = 0; + LOCK_COMMAND(&alloc_lock); do { /* if (!memory[position].used) { */ - LOCK_COMMAND(&alloc_lock); /* blas_lock(&memory[position].lock);*/ if (!memory[position].used) goto allocation; - UNLOCK_COMMAND(&alloc_lock); /* blas_unlock(&memory[position].lock);*/ /* } */ position ++; } while (position < NUM_BUFFERS); + UNLOCK_COMMAND(&alloc_lock); goto error;