diff options
author | Zhang Jiejing <jiejing.zhang@freescale.com> | 2012-06-06 10:05:26 +0800 |
---|---|---|
committer | Zhang Jiejing <jiejing.zhang@freescale.com> | 2012-06-06 18:21:14 +0800 |
commit | 5d6f538f2fac4dba9d95cacbe84d0f83dfaee8ab (patch) | |
tree | e64e15923f7137b93a7ecfe21dd9c8e7af894df8 /include | |
parent | 1beb7dfbd2b9eefa5369463fdf2fd3cca9804ee0 (diff) |
ENGR00212489-2 Android: lowmemerykiller: add reserved memroy account function.
Add GPU shared memory accounting to get better result of low memory killer.
the original low memory killer only take care of system memory accounting,
but for so large shared memory occupy by GPU, and each process memory killer
account become unfair, very large 3D game will not killed firstly if it going
to background.
Add this account to let real large memory user get killed if going to background
eg, the "angry bird Space" will acquire 68,215,360 GPU memory for 1-6 toll-gate.
The test show it can quicker recovery from memory shortage situation,
since it's very like to be killed after add so much GPU memory for such 3D game.
Signed-off-by: Zhang Jiejing <jiejing.zhang@freescale.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/resmem_account.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/include/linux/resmem_account.h b/include/linux/resmem_account.h new file mode 100644 index 000000000000..6eaad01ba00e --- /dev/null +++ b/include/linux/resmem_account.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2012 Freescale Semiconductor, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef RESMEM_ACCOUNT_H +#define RESMEM_ACCOUNT_H + +struct reserved_memory_account { + struct list_head link; + const char *name; + void *data; + size_t (*get_total_pages) (struct reserved_memory_account *m); + size_t (*get_page_used_by_process) (struct task_struct *p, struct reserved_memory_account *m); +}; + +void register_reserved_memory_account(struct reserved_memory_account *handler); +void unregister_reserved_memory_account(struct reserved_memory_account *handler); + +#endif |