aboutsummaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorYi-wei Zhao <gbjc64@motorola.com>2014-12-30 16:48:30 -0600
committerMister Oyster <oysterized@gmail.com>2017-04-11 11:00:03 +0200
commit0151010442c33d0a79368a9e30f1979b0858ba5b (patch)
tree4cdeeeebb84417b55014d325d9742cc75596b50d /include/linux
parentf7b445954612ca791c14598e9d5afaced40f76fc (diff)
drivers:lmk: 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: current: average time to find a task to kill : 1004us optimized: average time to find a task to kill: 43us Change-Id: I32504e9f2f370d58c038eea7457d95c8ed8b6b9b Signed-off-by: Hong-Mei Li <a21834@motorola.com> Signed-off-by: Yi-wei Zhao <gbjc64@motorola.com> Reviewed-on: http://gerrit.mot.com/701205 SLTApproved: Slta Waiver <sltawvr@motorola.com> Tested-by: Jira Key <jirakey@motorola.com> Submit-Approved: Jira Key <jirakey@motorola.com> Conflicts: drivers/staging/android/Kconfig include/linux/sched.h
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/sched.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 87c9f2f0a..4b6320c37 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1206,6 +1206,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
@@ -1576,6 +1579,14 @@ 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,