AnsweredAssumed Answered

linux aio with mmap

Question asked by 慕晗 潘 on Sep 13, 2017

using mmap64 to get ddr address,then using linux aio to write files,but the speed is very low.if not using mmap , the speed is ok!

int fd_mem;
unsigned long long ddrStart = 0x200000000ULL;
unsigned long long ddrPhyAddress = 0x200000000ULL;
unsigned long long ddrSize = 0x80000000ULL;
long unsigned int *tmp;
fd_mem = open("/dev/mem", O_RDWR | O_SYNC);
if (fd_mem < 0)
{
printf("open /dev/mem faild\n");
return -1;
}


ddrStart = (long unsigned int)mmap((void*)ddrStart, ddrSize,
PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_LOCKED | MAP_NORESERVE,
fd_mem, ddrPhyAddress);
if ((void *)ddrStart == MAP_FAILED)
{
close(fd_mem);
printf("mmap memory failed\n");
return -1;
}

Outcomes