Wind River Support Network


LIN8-9317 : cma reserved memory is stolen by userspace application

Created: Jun 15, 2018    Updated: Dec 3, 2018
Resolved Date: Jul 13, 2018
Found In Version:
Fix Version:
Severity: Severe
Applicable for: Wind River Linux 8
Component/s: Kernel, Userspace


A simple application that does mallocs in user space ends up using the CMA reserved memory. 
When CMA area is used by a couple of drivers, the principal one is a network card driver.
In this example, when the network card driver wants to use the CMA finds that it cannot alloc memory and fails. 
I am attaching a very simple program that does a 30MB malloc (and fills it) each second.
When checking /proc/meminfo while test application is runing,  the CmaFree is smaller and smaller until 0. I am also attaching a log with subsequent interrogations to showcase this - mem.txt
This issue has been reproduced in customer's environment, with HP firmware. 
CMA definition is made in the kernel cmdline: cma=100M@0M-960M

Config line:
wrlinux-8/wrlinux/configure --enable-board=intel-x86-64 --enable-rootfs=glibc-core+build_libc --enable-kernel=standard --enable-build=production --with-layer=/workspace/anca/hp/wr-dfu-util,/workspace/anca/hp/wr-full-vim --enable-reconfig --with-init=sysvinit --with-license-blacklist=GPLv3,LGPLv3,GPLv3+,LGPLv3 --enable-jobs=40 --enable-parallel-pkgbuilds=40

When tested with our kernel (4.1) and a later version, 4.9 and have noticed the problem no longer occurs in 4.9

Steps to Reproduce

1. Configure and build prj with line from description
2. Define cma in kernel bootline: cma=100M@0M-960M
3. Boot x86-64 board
4. Run test2 binary attached
5. Check /proc/meminfo while test is running

Other Downloads

Live chat