xref: /linux/Documentation/admin-guide/mm/cma_debugfs.rst (revision 4f4cfa6c560c93ba180c30675cf845e1597de44c)
1*01c0aa79SMauro Carvalho Chehab=====================
2*01c0aa79SMauro Carvalho ChehabCMA Debugfs Interface
3*01c0aa79SMauro Carvalho Chehab=====================
4*01c0aa79SMauro Carvalho Chehab
517e0db82SSasha LevinThe CMA debugfs interface is useful to retrieve basic information out of the
617e0db82SSasha Levindifferent CMA areas and to test allocation/release in each of the areas.
717e0db82SSasha Levin
817e0db82SSasha LevinEach CMA zone represents a directory under <debugfs>/cma/, indexed by the
917e0db82SSasha Levinkernel's CMA index. So the first CMA zone would be:
1017e0db82SSasha Levin
1117e0db82SSasha Levin	<debugfs>/cma/cma-0
1217e0db82SSasha Levin
1317e0db82SSasha LevinThe structure of the files created under that directory is as follows:
1417e0db82SSasha Levin
1517e0db82SSasha Levin - [RO] base_pfn: The base PFN (Page Frame Number) of the zone.
1617e0db82SSasha Levin - [RO] count: Amount of memory in the CMA area.
1717e0db82SSasha Levin - [RO] order_per_bit: Order of pages represented by one bit.
1817e0db82SSasha Levin - [RO] bitmap: The bitmap of page states in the zone.
19*01c0aa79SMauro Carvalho Chehab - [WO] alloc: Allocate N pages from that CMA area. For example::
2017e0db82SSasha Levin
2117e0db82SSasha Levin	echo 5 > <debugfs>/cma/cma-2/alloc
2217e0db82SSasha Levin
2317e0db82SSasha Levinwould try to allocate 5 pages from the cma-2 area.
2417e0db82SSasha Levin
2517e0db82SSasha Levin - [WO] free: Free N pages from that CMA area, similar to the above.
26