aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorHong-Mei Li <a21834@motorola.com>2013-06-28 19:26:38 +0800
committerSimon Shields <keepcalm444@gmail.com>2016-06-13 14:47:39 +1000
commit6f04da23b1e3aa60626bfef868ee89a77cebd637 (patch)
tree965631521a4d3b9831846da116efda37ddeae69b /kernel
parent8f5f33a7fd66e85d8d8502b5ee9c1c731ff0aeb5 (diff)
downloadkernel_samsung_smdk4412-6f04da23b1e3aa60626bfef868ee89a77cebd637.zip
kernel_samsung_smdk4412-6f04da23b1e3aa60626bfef868ee89a77cebd637.tar.gz
kernel_samsung_smdk4412-6f04da23b1e3aa60626bfef868ee89a77cebd637.tar.bz2
staging: android: lowmemorykiller: implement task's adj rbtree
Based on the current LMK implementation, LMK has to scan all processes to select the correct task to kill during low memory. The basic idea for the optimization is to : queue all tasks with oom_score_adj priority, and then LMK just selects the proper task from the queue(rbtree) to kill. performance improvement: the current implementation: average time to find a task to kill : 1004us the optimized implementation: average time to find a task to kill: 43us Change-Id: I4dbbdd5673314dbbdabb71c3eff0dc229ce4ea91 Signed-off-by: Hong-Mei Li <a21834@motorola.com> Reviewed-on: http://gerrit.pcs.mot.com/548917 SLT-Approved: Slta Waiver <sltawvr@motorola.com> Tested-by: Jira Key <jirakey@motorola.com> Reviewed-by: Yi-Wei Zhao <gbjc64@motorola.com> Submit-Approved: Jira Key <jirakey@motorola.com> Signed-off-by: D. Andrei Măceș <dmaces@nd.edu> Conflicts: drivers/staging/android/Kconfig drivers/staging/android/lowmemorykiller.c fs/proc/base.c mm/oom_kill.c Conflicts: drivers/staging/android/lowmemorykiller.c mm/oom_kill.c Conflicts: mm/oom_kill.c Conflicts: drivers/staging/android/lowmemorykiller.c mm/oom_kill.c
Diffstat (limited to 'kernel')
-rw-r--r--kernel/exit.c1
-rw-r--r--kernel/fork.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index 97dd317..6b8a7af 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -68,6 +68,7 @@ static void __unhash_process(struct task_struct *p, bool group_dead)
detach_pid(p, PIDTYPE_SID);
list_del_rcu(&p->tasks);
+ delete_from_adj_tree(p);
list_del_init(&p->sibling);
__this_cpu_dec(process_counts);
}
diff --git a/kernel/fork.c b/kernel/fork.c
index 0400fdf..c1760e6 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1379,6 +1379,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
attach_pid(p, PIDTYPE_SID, task_session(current));
list_add_tail(&p->sibling, &p->real_parent->children);
list_add_tail_rcu(&p->tasks, &init_task.tasks);
+ add_2_adj_tree(p);
__this_cpu_inc(process_counts);
}
attach_pid(p, PIDTYPE_PID, pid);