diff --git a/common_linux.h b/common_linux.h index 8b3d44bfa..45a688d23 100644 --- a/common_linux.h +++ b/common_linux.h @@ -68,9 +68,13 @@ extern long int syscall (long int __sysno, ...); static inline int my_mbind(void *addr, unsigned long len, int mode, unsigned long *nodemask, unsigned long maxnode, unsigned flags) { +#if defined (LOONGSON3B) + return syscall(SYS_mbind, addr, len, mode, nodemask, maxnode, flags); +#else //Fixed randomly SEGFAULT when nodemask==NULL with above Linux 2.6.34 unsigned long null_nodemask=0; return syscall(SYS_mbind, addr, len, mode, &null_nodemask, maxnode, flags); +#endif } static inline int my_set_mempolicy(int mode, const unsigned long *addr, unsigned long flag) { diff --git a/driver/others/memory.c b/driver/others/memory.c index ac9c87850..feb45eb58 100644 --- a/driver/others/memory.c +++ b/driver/others/memory.c @@ -389,12 +389,13 @@ static void *alloc_mmap(void *address){ if (map_address != (void *)-1) { #ifdef OS_LINUX -#ifdef DEBUG - int ret; +#if 1 + //#ifdef DEBUG + int ret=0; ret=my_mbind(map_address, BUFFER_SIZE * SCALING, MPOL_PREFERRED, NULL, 0, 0); if(ret==-1){ int errsv=errno; - perror("alloc_mmap:"); + perror("OpenBLAS alloc_mmap:"); printf("error code=%d,\tmap_address=%lx\n",errsv,map_address); }