xref: /OK3568_Linux_fs/kernel/Documentation/admin-guide/mm/cma_debugfs.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun=====================
2*4882a593SmuzhiyunCMA Debugfs Interface
3*4882a593Smuzhiyun=====================
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunThe CMA debugfs interface is useful to retrieve basic information out of the
6*4882a593Smuzhiyundifferent CMA areas and to test allocation/release in each of the areas.
7*4882a593Smuzhiyun
8*4882a593SmuzhiyunEach CMA zone represents a directory under <debugfs>/cma/, indexed by the
9*4882a593Smuzhiyunkernel's CMA index. So the first CMA zone would be:
10*4882a593Smuzhiyun
11*4882a593Smuzhiyun	<debugfs>/cma/cma-0
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunThe structure of the files created under that directory is as follows:
14*4882a593Smuzhiyun
15*4882a593Smuzhiyun - [RO] base_pfn: The base PFN (Page Frame Number) of the zone.
16*4882a593Smuzhiyun - [RO] count: Amount of memory in the CMA area.
17*4882a593Smuzhiyun - [RO] order_per_bit: Order of pages represented by one bit.
18*4882a593Smuzhiyun - [RO] bitmap: The bitmap of page states in the zone.
19*4882a593Smuzhiyun - [WO] alloc: Allocate N pages from that CMA area. For example::
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun	echo 5 > <debugfs>/cma/cma-2/alloc
22*4882a593Smuzhiyun
23*4882a593Smuzhiyunwould try to allocate 5 pages from the cma-2 area.
24*4882a593Smuzhiyun
25*4882a593Smuzhiyun - [WO] free: Free N pages from that CMA area, similar to the above.
26