Browse Source

Fixed mbind bug on Loongson 3B. Check the return value of my_mbind function.

tags/v0.1.0^2
Xianyi Zhang 14 years ago
parent
commit
ef6f7f32ae
2 changed files with 8 additions and 3 deletions
  1. +4
    -0
      common_linux.h
  2. +4
    -3
      driver/others/memory.c

+ 4
- 0
common_linux.h View File

@@ -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) {


+ 4
- 3
driver/others/memory.c View File

@@ -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);
}



Loading…
Cancel
Save