From 3967da2dd1f97b8d558207d8d720d699aca3d566 Mon Sep 17 00:00:00 2001 From: Srivatsa Vaddagiri Date: Sat, 29 Mar 2014 11:40:16 -0700 Subject: sched: Window-based load stat improvements Some tasks can have a sporadic load pattern such that they can suddenly start running for longer intervals of time after running for shorter durations. To recognize such sharp increase in tasks' demands, max between the average of 5 window load samples and the most recent sample is chosen as the task demand. Make the window size (sched_ravg_window) configurable at boot up time. To prevent users from setting inappropriate values for window size, min and max limits are defined. As 'ravg' struct tracks load for both real-time and non real-time tasks it is moved out of sched_entity struct. In order to prevent changing function signatures for move_tasks() and move_one_task() per-cpu variables are defined to track the total load moved. In case multiple tasks are selected to migrate in one load balance operation, loads > 100 could be sent through migration notifiers. Prevent this scenario by setting mnd.load to 100 in such cases. Define wrapper functions to compute cpu demands for tasks and to change rq->cumulative_runnable_avg. Change-Id: I9abfbf3b5fe23ae615a6acd3db9580cfdeb515b4 Signed-off-by: Srivatsa Vaddagiri Signed-off-by: Rohit Gupta [rameezmustafa@codeaurora.org: Port to msm-3.18 and squash "dcf7256 sched: window-stats: Fix overflow bug" into this patch.] Signed-off-by: Syed Rameez Mustafa [joonwoop@codeaurora.org: fixed conflict in __migrate_task().] Signed-off-by: Joonwoo Park --- include/linux/sched.h | 6 +----- include/linux/sched/sysctl.h | 1 - 2 files changed, 1 insertion(+), 6 deletions(-) (limited to 'include/linux') diff --git a/include/linux/sched.h b/include/linux/sched.h index 0a664c44ee28..bf4b9f5e2434 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1269,11 +1269,6 @@ struct ravg { struct sched_entity { struct load_weight load; /* for load-balancing */ - /* - * Todo : Move ravg to 'struct task_struct', as this is common for both - * real-time and non-realtime tasks - */ - struct ravg ravg; struct rb_node run_node; struct list_head group_node; unsigned int on_rq; @@ -1429,6 +1424,7 @@ struct task_struct { const struct sched_class *sched_class; struct sched_entity se; struct sched_rt_entity rt; + struct ravg ravg; #ifdef CONFIG_CGROUP_SCHED struct task_group *sched_task_group; #endif diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h index 5ccdf9c4eb13..e301e64ec4e1 100644 --- a/include/linux/sched/sysctl.h +++ b/include/linux/sched/sysctl.h @@ -40,7 +40,6 @@ extern unsigned int sysctl_sched_min_granularity; extern unsigned int sysctl_sched_wakeup_granularity; extern unsigned int sysctl_sched_child_runs_first; extern unsigned int sysctl_sched_wake_to_idle; -extern unsigned int sysctl_sched_ravg_window; extern unsigned int sysctl_sched_wakeup_load_threshold; enum sched_tunable_scaling { -- cgit v1.2.3