summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiaowen Liu <b37945@freescale.com>2014-04-28 14:06:52 +0800
committerXiaowen Liu <b37945@freescale.com>2014-04-28 14:25:24 +0800
commit1c6478842cdf932db9fe853a2307af068fc0574e (patch)
tree3a9460043664b4d861b73108a1a740f23d179424
parent13ab3417f798857d404ee3077216eebafdfbea94 (diff)
ENGR00310741 enable gpu low memory killer for 3.10 kernel.
rename CONFIG_ANDROID_RESERVED_MEMORY_ACCOUNT to CONFIG_GPU_LOW_MEMORY_KILLER. refine gpu low memory killer code. remove some unused code. move CONFIG_GPU_LOW_MEMORY_KILLER to gpu-viv Kconfig. Signed-off-by: Xiaowen Liu <b37945@freescale.com>
-rw-r--r--drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c12
-rw-r--r--drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h1
-rw-r--r--drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c34
3 files changed, 10 insertions, 37 deletions
diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c
index 0fc52e79a3df..ffee28b71abf 100644
--- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c
+++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel.c
@@ -629,7 +629,7 @@ gckKERNEL_Destroy(
return gcvSTATUS_OK;
}
-#ifdef CONFIG_ANDROID_RESERVED_MEMORY_ACCOUNT
+#ifdef CONFIG_GPU_LOW_MEMORY_KILLER
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/oom.h>
@@ -674,13 +674,15 @@ static int force_contiguous_lowmem_shrink(IN gckKERNEL Kernel)
task_unlock(p);
continue;
}
- oom_adj = sig->oom_adj;
+ oom_adj = sig->oom_score_adj;
if (oom_adj < min_adj) {
task_unlock(p);
continue;
}
tasksize = 0;
+ task_unlock(p);
+ read_unlock(&tasklist_lock);
if (gckKERNEL_QueryProcessDB(Kernel, p->pid, gcvFALSE, gcvDB_VIDEO_MEMORY, &info) == gcvSTATUS_OK){
tasksize += info.counters.bytes / PAGE_SIZE;
}
@@ -688,7 +690,7 @@ static int force_contiguous_lowmem_shrink(IN gckKERNEL Kernel)
tasksize += info.counters.bytes / PAGE_SIZE;
}
- task_unlock(p);
+ read_lock(&tasklist_lock);
if (tasksize <= 0)
continue;
@@ -772,7 +774,7 @@ gckKERNEL_AllocateLinearMemory(
gcmkVERIFY_ARGUMENT(Pool != gcvNULL);
gcmkVERIFY_ARGUMENT(Bytes != 0);
-#ifdef CONFIG_ANDROID_RESERVED_MEMORY_ACCOUNT
+#ifdef CONFIG_GPU_LOW_MEMORY_KILLER
_AllocateMemory_Retry:
#endif
/* Get initial pool. */
@@ -972,7 +974,7 @@ _AllocateMemory_Retry:
if (node == gcvNULL)
{
-#ifdef CONFIG_ANDROID_RESERVED_MEMORY_ACCOUNT
+#ifdef CONFIG_GPU_LOW_MEMORY_KILLER
if(forceContiguous == gcvTRUE)
{
if(force_contiguous_lowmem_shrink(Kernel) == 0)
diff --git a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h
index 9cc9626e3b06..feff9a43bacb 100644
--- a/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h
+++ b/drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_driver.h
@@ -42,7 +42,6 @@ extern "C" {
#define IOCTL_GCHAL_KERNEL_INTERFACE 30001
#define IOCTL_GCHAL_TERMINATE 30002
-#undef CONFIG_ANDROID_RESERVED_MEMORY_ACCOUNT
/******************************************************************************\
********************************* Command Codes ********************************
\******************************************************************************/
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c
index 1b0da4ffcbd0..66d2e0a6e348 100644
--- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c
+++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c
@@ -37,8 +37,7 @@
#endif
-#ifdef CONFIG_ANDROID_RESERVED_MEMORY_ACCOUNT
-# include <linux/resmem_account.h>
+#ifdef CONFIG_GPU_LOW_MEMORY_KILLER
# include <linux/kernel.h>
# include <linux/mm.h>
# include <linux/oom.h>
@@ -429,30 +428,6 @@ gckOS_DumpParam(
printk(" gpuProfiler = %d\n", gpuProfiler);
}
-#ifdef CONFIG_ANDROID_RESERVED_MEMORY_ACCOUNT
-static size_t viv_gpu_resmem_query(struct task_struct *p, struct reserved_memory_account *m);
-static struct reserved_memory_account viv_gpu_resmem_handler = {
- .name = "viv_gpu",
- .get_page_used_by_process = viv_gpu_resmem_query,
-};
-
-size_t viv_gpu_resmem_query(struct task_struct *p, struct reserved_memory_account *m)
-{
- gcuDATABASE_INFO info;
- unsigned int processid = p->pid;
- gckKERNEL gpukernel = m->data;
-
- /* ignore error happens in this api. */
- if (gckKERNEL_QueryProcessDB(gpukernel, processid, false, gcvDB_VIDEO_MEMORY, &info) != gcvSTATUS_OK)
- return 0;
-
- /* we return pages. */
- if (info.counters.bytes > 0)
- return info.counters.bytes / PAGE_SIZE;
- return 0;
-}
-#endif
-
int drv_open(
struct inode* inode,
struct file* filp
@@ -1123,10 +1098,8 @@ static int drv_init(struct device *pdev)
device->baseAddress = 0;
}
-#ifdef CONFIG_ANDROID_RESERVED_MEMORY_ACCOUNT
+#ifdef CONFIG_GPU_LOW_MEMORY_KILLER
task_free_register(&task_nb);
- viv_gpu_resmem_handler.data = device->kernels[gcvCORE_MAJOR];
- register_reserved_memory_account(&viv_gpu_resmem_handler);
#endif
@@ -1219,9 +1192,8 @@ static void drv_exit(void)
{
gcmkHEADER();
-#ifdef CONFIG_ANDROID_RESERVED_MEMORY_ACCOUNT
+#ifdef CONFIG_GPU_LOW_MEMORY_KILLER
task_free_unregister(&task_nb);
- unregister_reserved_memory_account(&viv_gpu_resmem_handler);
#endif
gcmkASSERT(gpuClass != gcvNULL);