summaryrefslogtreecommitdiff
path: root/kernel/sched/sched_avg.c (follow)
Commit message (Collapse)AuthorAge
* sched: add sched_get_cpu_last_busy_time() APIPavankumar Kondeti2018-03-06
| | | | | | | | | | | | | | sched_get_cpu_last_busy_time() returns the last time stamp when a given CPU is busy with more than 2 runnable tasks or has load greater than 50% of it's max capacity. The LPM driver can make use of this API and create a policy to prevent a recently loaded CPU entering deep sleep state. This API is implemented only for the higher capacity CPUs in the system. It returns 0 for other CPUs. Change-Id: I97ef47970a71647f4f55f21165d0cc1351770a53 Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
* core_ctl: un-isolate BIG CPUs more aggressivelyPavankumar Kondeti2017-05-31
| | | | | | | | | | | | | | | | | | | | | | The current algorithm to bring additional BIG CPUs is very conservative. It works when BIG tasks alone run on BIG cluster. When co-location and scheduler boost features are activated, small/medium tasks also run on BIG cluster. We don't want these tasks to downmigrate, when BIG CPUs are available but isolated. The following changes are done to un-isolate CPUs more aggressively. (1) Round up the big_avg. When the big_avg indicates that there are 1.5 tasks on an average in the last window, it indicates that we need 2 BIG CPUs not 1 BIG CPU. (2) Track the maximum number of running tasks in the last window on all CPUs. If any of the CPU in a cluster has more than 4 runnable tasks in the last window, bring an additional CPU to help out. Change-Id: Id05d9983af290760cec6d93d1bdc45bc5e924cce Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
* sched: Fix integer overflow in sched_update_nr_prod()Pavankumar Kondeti2016-10-04
| | | | | | | | | | | | | | | | | | | "int" type is used to hold the time difference between the successive updates to nr_run in sched_update_nr_prod(). This can result in overflow, if the function is called ~2.15 sec after it was called before. The most probable scenarios are when CPU is idle and hotplugged. But as we update the last_time of all possible CPUs in sched_get_nr_running_avg() periodically from a deferrable timer context (core_ctl module), this overflow is observed only when the system is completely idle for long time. When this overflow happens we hit a BUG_ON() in sched_get_nr_running_avg(). Use "u64" type instead of "int" for holding the time difference and add additional BUG_ON() to catch the instances where sched_clock() returns a backward value. Change-Id: I284abb5889ceb8cf9cc689c79ed69422a0e74986 Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
* sched: Aggregate for frequencySrivatsa Vaddagiri2016-05-26
| | | | | | | | | | | | | | | | | | | | | | | | | Related threads in a group could execute on different CPUs and hence present a split-demand picture to cpufreq governor. IOW the governor fails to see the net cpu demand of all related threads in a given window if the threads's execution were to be split across CPUs. That could result in sub-optimal frequency chosen in comparison to the ideal frequency at which the aggregate work (taken up by related threads) needs to be run. This patch aggregates cpu execution stats in a window for all related threads in a group. This helps present cpu busy time to governor as if all related threads were part of the same thread and thus help select the right frequency required by related threads. This aggregation is done per-cluster. Change-Id: I71e6047620066323721c6d542034ddd4b2950e7f Signed-off-by: Srivatsa Vaddagiri <vatsa@codeaurora.org> Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org> [joonwoop@codeaurora.org: Fixed notify_migration() to hold rcu read lock as this version of Linux doesn't hold p->pi_lock when the function gets called while keeping use of rcu_access_pointer() since we never dereference return value.] Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
* sched: Keep track of average nr_big_tasksSrivatsa Vaddagiri2016-03-23
| | | | | | | | | | | | Extend sched_get_nr_running_avg() API to return average nr_big_tasks, in addition to average nr_running and average nr_io_wait tasks. Also add a new trace point to record values returned by sched_get_nr_running_avg() API. Change-Id: Id3591e6d04da8db484b4d1cb9d95dba075f5ab9a Signed-off-by: Srivatsa Vaddagiri <vatsa@codeaurora.org> [rameezmustafa@codeaurora.org: Resolve trivial merge conflicts] Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
* sched: Fix bug in average nr_running and nr_iowait calculationSrivatsa Vaddagiri2016-03-23
| | | | | | | | | | | | | | | | | | | | | | | | | | sched_get_nr_running_avg() returns average nr_running and nr_iowait task count since it was last invoked. Fix several bugs in their calculation. * sched_update_nr_prod() needs to consider that nr_running count can change by more than 1 when CFS_BANDWIDTH feature is used * sched_get_nr_running_avg() needs to sum up nr_iowait count across all cpus, rather than just one * sched_get_nr_running_avg() could race with sched_update_nr_prod(), as a result of which it could use curr_time which is behind a cpu's 'last_time' value. That would lead to erroneous calculation of average nr_running or nr_iowait. While at it, fix also a bug in BUG_ON() check in sched_update_nr_prod() function and remove unnecessary nr_running argument to sched_update_nr_prod() function. Change-Id: I46737614737292fae0d7204c4648fb9b862f65b2 Signed-off-by: Srivatsa Vaddagiri <vatsa@codeaurora.org> [rameezmustafa@codeaurora.org: Port to msm-3.18] Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
* sched_avg: add run queue averagingJeff Ohlstein2016-03-23
Add code to calculate the run queue depth of a cpu and iowait depth of the cpu. The scheduler calls in to sched_update_nr_prod whenever there is a runqueue change. This function maintains the runqueue average and the iowait of that cpu in that time interval. Whoever wants to know the runqueue average is expected to call sched_get_nr_running_avg periodically to get the accumulated runqueue and iowait averages for all the cpus. Change-Id: Id8cb2ecf0ed479f090a83ccb72dd59c53fa73e0c Signed-off-by: Jeff Ohlstein <johlstei@codeaurora.org> (cherry picked from commit 0299fcaaad80e2c0ac9aa583c95107f6edc27750) [rameezmustafa@codeaurora.org: Port to msm-3.18] Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>