MMA Q&A

Q: How to adjust mma memory?

DDR total memory = linux memory+ mma + kernel reserved

To view the linux memory size, you can check the MemTotal parameter

cat /proc/meminfo

To view the size of mma, you can check the length parameter

cat/proc/mi_modules/mi_sys_mma/mma_heap_name0

The reserved part of the kernel is generally fixed, so when the mma increases, the corresponding linux memory will decrease, otherwise the linux memory will increase. Linux memory is used for linux system call and allocation, such as malloc. MMA is used by the internal hardware IP of SDK. If there is linux oom, linux memory is not enough, you can reduce the size of mma to increase linux memory; if there is mma alloc fail, mma is not enough, then you can increase the size of mma appropriately. The allocation of mma and linux memory size should be determined according to the actual use scenario, and the excess mma is used for linux memory in the maximum use scenario to ensure that the system memory is sufficient.

  1. Increase mma, reduce linux memory

    Increase the debug level of sys to MI_DBG_KMSG, and the usage of mma will be automatically printed when alloc mma fail is prompted:

    When the program is running, the printed log is [MI ERR ]: MI_SYS_IMPL\_MmaAlloc[6195]: fail!, please modify the config file in project/configs/defconfigs to add the memory of mma.

    For example, open dispcam_p3_spinand.glibc-9.1.0-s01a.64.qfn128.demo_defconfig to find CONFIG_KERNEL_BOOT_ENV config option, and then modify the size of sz in mma_heap=mma_heap_name0,miu=0,sz=0x1E00000.

    Setting the size of mma is sufficient to allow the program to run normally in the scene where the mma memory usage is the largest, and then enter cat /proc/mi_modules/mi_sys_mma/mma_heap_name0 to view the size of chunk_mgr_avail. This parameter represents the remaining memory available for mma, minus the size of chunk_mgr_avail from the previously set mma size and reserve more as the final mma size to write into the config file.

  2. Reduce mma, increase linux memory

    Print Out of memory when the program is running, use cat/proc/meminfo to check MemFree, and increase the size of linux memory to ensure that the application can run normally.

    Modify the config file in project/configs/defconfigs, reduce mma to increase linux memory.

    We need a value so that the SDK can apply for memory from mma and the Linux application does not prompt out of memory. Generally, first adjust mma to take a critical value and give the rest to linux memory.

...