mm: fix Lost RAM too large problem when playing 4k [1/2]

PD#SWPL-16990

Problem:
Lost RAM will be over 200MB when playing 4K.

Solution:
Add cma pages in /proc/meminfo and give a information
for android layer to count them.

Verify:
x301

Change-Id: I99d1ded53ed351a5cb0d24f0e03850a55ef0d272
Signed-off-by: Tao Zeng <tao.zeng@amlogic.com>
This commit is contained in:
Tao Zeng
2019-11-25 10:26:51 +08:00
committed by Chris
parent 9a149fa4b0
commit ea094c64aa
4 changed files with 21 additions and 2 deletions

View File

@@ -817,7 +817,6 @@ static const struct file_operations cma_dbg_file_ops = {
static int __init aml_cma_init(void)
{
atomic_set(&cma_allocate, 0);
atomic_long_set(&nr_cma_allocated, 0);
dentry = proc_create("cma_debug", 0644, NULL, &cma_dbg_file_ops);
if (IS_ERR_OR_NULL(dentry)) {

View File

@@ -30,6 +30,12 @@
#include <linux/vmalloc.h>
#include <linux/mm.h>
#include <linux/amlogic/page_trace.h>
#ifdef CONFIG_AMLOGIC_VMAP
#include <linux/amlogic/vmap_stack.h>
#endif
#ifdef CONFIG_AMLOGIC_CMA
#include <linux/amlogic/aml_cma.h>
#endif
#include <asm/stacktrace.h>
#include <asm/sections.h>
@@ -1703,3 +1709,14 @@ void __init page_trace_mem_init(void)
#endif
}
void arch_report_meminfo(struct seq_file *m)
{
#ifdef CONFIG_AMLOGIC_CMA
seq_printf(m, "DriverCma: %8ld kB\n",
get_cma_allocated() * (1 << (PAGE_SHIFT - 10)));
#endif
#ifdef CONFIG_AMLOGIC_VMAP
vmap_report_meminfo(m);
#endif
}

View File

@@ -602,7 +602,7 @@ static int shrink_vm_stack(unsigned long low, unsigned long high)
return pages;
}
void arch_report_meminfo(struct seq_file *m)
void vmap_report_meminfo(struct seq_file *m)
{
unsigned long kb = 1 << (PAGE_SHIFT - 10);
unsigned long tmp1, tmp2, tmp3;

View File

@@ -18,6 +18,8 @@
#ifndef __VMAP_STACK_H__
#define __VMAP_STACK_H__
#include <linux/seq_file.h>
#define STACK_SHRINK_THRESHOLD (PAGE_SIZE + 1024)
#define STACK_SHRINK_SLEEP (HZ)
#ifdef CONFIG_64BIT
@@ -79,6 +81,7 @@ extern int is_vmap_addr(unsigned long addr);
extern void aml_stack_free(struct task_struct *tsk);
extern void *aml_stack_alloc(int node, struct task_struct *tsk);
extern void aml_account_task_stack(struct task_struct *tsk, int account);
void vmap_report_meminfo(struct seq_file *m);
#ifdef CONFIG_ARM
extern int on_irq_stack(unsigned long sp, int cpu);
#endif