diff options
author | Hong-Mei Li <a21834@motorola.com> | 2013-06-28 19:26:38 +0800 |
---|---|---|
committer | Simon Shields <keepcalm444@gmail.com> | 2016-06-13 14:47:39 +1000 |
commit | 6f04da23b1e3aa60626bfef868ee89a77cebd637 (patch) | |
tree | 965631521a4d3b9831846da116efda37ddeae69b /include | |
parent | 8f5f33a7fd66e85d8d8502b5ee9c1c731ff0aeb5 (diff) | |
download | kernel_samsung_smdk4412-6f04da23b1e3aa60626bfef868ee89a77cebd637.tar.gz kernel_samsung_smdk4412-6f04da23b1e3aa60626bfef868ee89a77cebd637.tar.bz2 kernel_samsung_smdk4412-6f04da23b1e3aa60626bfef868ee89a77cebd637.zip |
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 'include')
-rw-r--r-- | include/linux/sched.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 6d2e88872e9..6b030a526d4 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1284,6 +1284,9 @@ struct task_struct { #endif struct list_head tasks; +#ifdef CONFIG_ANDROID_LMK_ADJ_RBTREE + struct rb_node adj_node; +#endif #ifdef CONFIG_SMP struct plist_node pushable_tasks; #endif @@ -1623,6 +1626,13 @@ static inline struct pid *task_tgid(struct task_struct *task) return task->group_leader->pids[PIDTYPE_PID].pid; } +#ifdef CONFIG_ANDROID_LMK_ADJ_RBTREE +extern void add_2_adj_tree(struct task_struct *task); +extern void delete_from_adj_tree(struct task_struct *task); +#else +static inline void add_2_adj_tree(struct task_struct *task) { } +static inline void delete_from_adj_tree(struct task_struct *task) { } +#endif /* * Without tasklist or rcu lock it is not safe to dereference * the result of task_pgrp/task_session even if task == current, |