summaryrefslogtreecommitdiff
path: root/drivers/mxc/gpu-viv
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mxc/gpu-viv')
-rw-r--r--drivers/mxc/gpu-viv/Kconfig11
-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_allocator.c4
-rw-r--r--drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_driver.c34
5 files changed, 23 insertions, 39 deletions
diff --git a/drivers/mxc/gpu-viv/Kconfig b/drivers/mxc/gpu-viv/Kconfig
index e9cc4b27614c..7eb8956ee690 100644
--- a/drivers/mxc/gpu-viv/Kconfig
+++ b/drivers/mxc/gpu-viv/Kconfig
@@ -6,4 +6,15 @@ config MXC_GPU_VIV
---help---
Say Y to get the GPU driver support.
+config GPU_LOW_MEMORY_KILLER
+ tristate "Reserved memory account to Low memory Killer"
+ depends on ANDROID
+ default n
+ ---help---
+ Resigter reserved memory account to low memory killer, These
+ reserved memory is mainly used by GPU driver, but it's not
+ account by low memory killer, so even it takes much memory,
+ it will not killed. add this to fix this, it will kill the
+ large memory app in background.
+
endmenu
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_allocator.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_allocator.c
index 0342660db900..e5bfeaa8ea7a 100644
--- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_allocator.c
+++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_allocator.c
@@ -886,9 +886,9 @@ gckALLOCATOR_Construct(
);
gcmkONERROR(
- gckOS_Allocate(Os, gcmSIZEOF(gckALLOCATOR), (gctPOINTER *)&allocator));
+ gckOS_Allocate(Os, gcmSIZEOF(gcsALLOCATOR), (gctPOINTER *)&allocator));
- gckOS_ZeroMemory(allocator, gcmSIZEOF(gckALLOCATOR));
+ gckOS_ZeroMemory(allocator, gcmSIZEOF(gcsALLOCATOR));
/* Record os. */
allocator->os = Os;
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);