AnsweredAssumed Answered

Error handling mmap: Memory leak and "GART error"

Question asked by ribalda on May 22, 2013
Latest reply on Aug 4, 2014 by pinform

We are trying to process images from a framegrabber without copying them to an intermediate buffer. The data appears on a mmaped buffer.


Every time we use the mmaped buffer on OpenCL we are getting an error message on syslog  and the Slab section of /proc/mem_info increases. On our system we are leaking around 1 MB per second!


syslog error: [fglrx:MCIL_LockMemory] *ERROR* Could not lock memory into GART space


In order to demonstrate this error we have made a simple program with a loop that maps and unmaps a mmaped buffer. While running the program please run dmesg and examine /proc/mem_info. The exact program on other OpenCL implementations (ie. Nvidia) works fine. We are using fglrx v 13.4, but the error exist also in previous versions.


After some debugging we believe that it is caused by the function ATI_API_CALL KCL_LockUserPages (firegl_public.c) which calls get_user_pages, that returns -EFAULT  on mmaped or io pages, (and also check for write permissions):


if (!vma ||

    (vma->vm_flags & (VM_IO | VM_PFNMAP)) ||

    !(vm_flags & vma->vm_flags))

return i ? : -EFAULT;


Please realize that this is a huge restriction for us, who in order to work with images from the framebuffer would have to copy its content to another area with no reason, reducing our framerate dramatically. Also it is incomprehensible why we wont be able to use mmaped buffers.