{"push_id":1041574654,"size":7,"distinct_size":7,"ref":"refs/heads/cm-13.0-x","head":"23ac5fa6417a98679629a2bd2ae76e4e0cf6ce7c","before":"aaeac06a622d2bb995acdf2a7e09002ca40737da","commits":[{"sha":"6b240afe744b07069014e1e550295cdc56944b2f","author":{"email":"5b23f8226e886b22344fc642373ea657dd596b63@linux.vnet.ibm.com","name":"Srivatsa S. Bhat"},"message":"cpufreq: governor: Be friendly towards latency-sensitive bursty workloads\n\nCpufreq governors like the ondemand governor calculate the load on the CPU\nperiodically by employing deferrable timers. A deferrable timer won't fire\nif the CPU is completely idle (and there are no other timers to be run), in\norder to avoid unnecessary wakeups and thus save CPU power.\n\nHowever, the load calculation logic is agnostic to all this, and this can\nlead to the problem described below.\n\nTime (ms)               CPU 1\n\n100                Task-A running\n\n110                Governor's timer fires, finds load as 100% in the last\n                   10ms interval and increases the CPU frequency.\n\n110.5              Task-A running\n\n120\t\t   Governor's timer fires, finds load as 100% in the last\n\t\t   10ms interval and increases the CPU frequency.\n\n125\t\t   Task-A went to sleep. With nothing else to do, CPU 1\n\t\t   went completely idle.\n\n200\t\t   Task-A woke up and started running again.\n\n200.5\t\t   Governor's deferred timer (which was originally programmed\n\t\t   to fire at time 130) fires now. It calculates load for the\n\t\t   time period 120 to 200.5, and finds the load is almost zero.\n\t\t   Hence it decreases the CPU frequency to the minimum.\n\n210\t\t   Governor's timer fires, finds load as 100% in the last\n\t\t   10ms interval and increases the CPU frequency.\n\nSo, after the workload woke up and started running, the frequency was suddenly\ndropped to absolute minimum, and after that, there was an unnecessary delay of\n10ms (sampling period) to increase the CPU frequency back to a reasonable value.\nAnd this pattern repeats for every wake-up-from-cpu-idle for that workload.\nThis can be quite undesirable for latency- or response-time sensitive bursty\nworkloads. So we need to fix the governor's logic to detect such wake-up-from-\ncpu-idle scenarios and start the workload at a reasonably high CPU frequency.\n\nOne extreme solution would be to fake a load of 100% in such scenarios. But\nthat might lead to undesirable side-effects such as frequency spikes (which\nmight also need voltage changes) especially if the previous frequency happened\nto be very low.\n\nWe just want to avoid the stupidity of dropping down the frequency to a minimum\nand then enduring a needless (and long) delay before ramping it up back again.\nSo, let us simply carry forward the previous load - that is, let us just pretend\nthat the 'load' for the current time-window is the same as the load for the\nprevious window. That way, the frequency and voltage will continue to be set\nto whatever values they were set at previously. This means that bursty workloads\nwill get a chance to influence the CPU frequency at which they wake up from\ncpu-idle, based on their past execution history. Thus, they might be able to\navoid suffering from slow wakeups and long response-times.\n\nHowever, we should take care not to over-do this. For example, such a \"copy\nprevious load\" logic will benefit cases like this: (where # represents busy\nand . represents idle)\n\n##########.........#########.........###########...........##########........\n\nbut it will be detrimental in cases like the one shown below, because it will\nretain the high frequency (copied from the previous interval) even in a mostly\nidle system:\n\n##########.........#.................#.....................#...............\n\n(i.e., the workload finished and the remaining tasks are such that their busy\nperiods are smaller than the sampling interval, which causes the timer to\nalways get deferred. So, this will make the copy-previous-load logic copy\nthe initial high load to subsequent idle periods over and over again, thus\nkeeping the frequency high unnecessarily).\n\nSo, we modify this copy-previous-load logic such that it is used only once\nupon every wakeup-from-idle. Thus if we have 2 consecutive idle periods, the\nprevious load won't get blindly copied over; cpufreq will freshly evaluate the\nload in the second idle interval, thus ensuring that the system comes back to\nits normal state.\n\n[ The right way to solve this whole problem is to teach the CPU frequency\ngovernors to also track load on a per-task basis, not just a per-CPU basis,\nand then use both the data sources intelligently to set the appropriate\nfrequency on the CPUs. But that involves redesigning the cpufreq subsystem,\nso this patch should make the situation bearable until then. ]\n\nExperimental results:\n+-------------------+\n\nI ran a modified version of ebizzy (called 'sleeping-ebizzy') that sleeps in\nbetween its execution such that its total utilization can be a user-defined\nvalue, say 10% or 20% (higher the utilization specified, lesser the amount of\nsleeps injected). This ebizzy was run with a single-thread, tied to CPU 8.\n\nBehavior observed with tracing (sample taken from 40% utilization runs):\n------------------------------------------------------------------------\n\nWithout patch:\n~~~~~~~~~~~~~~\nkworker/8:2-12137  416.335742: cpu_frequency: state=2061000 cpu_id=8\nkworker/8:2-12137  416.335744: sched_switch: prev_comm=kworker/8:2 ==> next_comm=ebizzy\n      <...>-40753  416.345741: sched_switch: prev_comm=ebizzy ==> next_comm=kworker/8:2\nkworker/8:2-12137  416.345744: cpu_frequency: state=4123000 cpu_id=8\nkworker/8:2-12137  416.345746: sched_switch: prev_comm=kworker/8:2 ==> next_comm=ebizzy\n      <...>-40753  416.355738: sched_switch: prev_comm=ebizzy ==> next_comm=kworker/8:2\n<snip>  ---------------------------------------------------------------------  <snip>\n      <...>-40753  416.402202: sched_switch: prev_comm=ebizzy ==> next_comm=swapper/8\n     <idle>-0      416.502130: sched_switch: prev_comm=swapper/8 ==> next_comm=ebizzy\n      <...>-40753  416.505738: sched_switch: prev_comm=ebizzy ==> next_comm=kworker/8:2\nkworker/8:2-12137  416.505739: cpu_frequency: state=2061000 cpu_id=8\nkworker/8:2-12137  416.505741: sched_switch: prev_comm=kworker/8:2 ==> next_comm=ebizzy\n      <...>-40753  416.515739: sched_switch: prev_comm=ebizzy ==> next_comm=kworker/8:2\nkworker/8:2-12137  416.515742: cpu_frequency: state=4123000 cpu_id=8\nkworker/8:2-12137  416.515744: sched_switch: prev_comm=kworker/8:2 ==> next_comm=ebizzy\n\nObservation: Ebizzy went idle at 416.402202, and started running again at\n416.502130. But cpufreq noticed the long idle period, and dropped the frequency\nat 416.505739, only to increase it back again at 416.515742, realizing that the\nworkload is in-fact CPU bound. Thus ebizzy needlessly ran at the lowest frequency\nfor almost 13 milliseconds (almost 1 full sample period), and this pattern\nrepeats on every sleep-wakeup. This could hurt latency-sensitive workloads quite\na lot.\n\nWith patch:\n~~~~~~~~~~~\n\nkworker/8:2-29802  464.832535: cpu_frequency: state=2061000 cpu_id=8\n<snip>  ---------------------------------------------------------------------  <snip>\nkworker/8:2-29802  464.962538: sched_switch: prev_comm=kworker/8:2 ==> next_comm=ebizzy\n      <...>-40738  464.972533: sched_switch: prev_comm=ebizzy ==> next_comm=kworker/8:2\nkworker/8:2-29802  464.972536: cpu_frequency: state=4123000 cpu_id=8\nkworker/8:2-29802  464.972538: sched_switch: prev_comm=kworker/8:2 ==> next_comm=ebizzy\n      <...>-40738  464.982531: sched_switch: prev_comm=ebizzy ==> next_comm=kworker/8:2\n<snip>  ---------------------------------------------------------------------  <snip>\nkworker/8:2-29802  465.022533: sched_switch: prev_comm=kworker/8:2 ==> next_comm=ebizzy\n      <...>-40738  465.032531: sched_switch: prev_comm=ebizzy ==> next_comm=kworker/8:2\nkworker/8:2-29802  465.032532: sched_switch: prev_comm=kworker/8:2 ==> next_comm=ebizzy\n      <...>-40738  465.035797: sched_switch: prev_comm=ebizzy ==> next_comm=swapper/8\n     <idle>-0      465.240178: sched_switch: prev_comm=swapper/8 ==> next_comm=ebizzy\n      <...>-40738  465.242533: sched_switch: prev_comm=ebizzy ==> next_comm=kworker/8:2\nkworker/8:2-29802  465.242535: sched_switch: prev_comm=kworker/8:2 ==> next_comm=ebizzy\n      <...>-40738  465.252531: sched_switch: prev_comm=ebizzy ==> next_comm=kworker/8:2\n\nObservation: Ebizzy went idle at 465.035797, and started running again at\n465.240178. Since ebizzy was the only real workload running on this CPU,\ncpufreq retained the frequency at 4.1Ghz throughout the run of ebizzy, no\nmatter how many times ebizzy slept and woke-up in-between. Thus, ebizzy\ngot the 10ms worth of 4.1 Ghz benefit during every sleep-wakeup (as compared\nto the run without the patch) and this boost gave a modest improvement in total\nthroughput, as shown below.\n\nSleeping-ebizzy records-per-second:\n-----------------------------------\n\nUtilization  Without patch  With patch  Difference (Absolute and % values)\n    10%         274767        277046        +  2279 (+0.829%)\n    20%         543429        553484        + 10055 (+1.850%)\n    40%        1090744       1107959        + 17215 (+1.578%)\n    60%        1634908       1662018        + 27110 (+1.658%)\n\nA rudimentary and somewhat approximately latency-sensitive workload such as\nsleeping-ebizzy itself showed a consistent, noticeable performance improvement\nwith this patch. Hence, workloads that are truly latency-sensitive will benefit\nquite a bit from this change. Moreover, this is an overall win-win since this\npatch does not hurt power-savings at all (because, this patch does not reduce\nthe idle time or idle residency; and the high frequency of the CPU when it goes\nto cpu-idle does not affect/hurt the power-savings of deep idle states).\n\nSigned-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>\nReviewed-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>\nAcked-by: Viresh Kumar <viresh.kumar@linaro.org>\nSigned-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>\nSigned-off-by: flar2 <asegaert@gmail.com>","distinct":true,"url":"https://api.github.com/repos/kimjisoo/android_kernel_lge_bullhead/commits/6b240afe744b07069014e1e550295cdc56944b2f"},{"sha":"04571c94e763ab7fd056f95fd8346a66d01be536","author":{"email":"50cb9bee76fd6567c3233b8a89e4a594c545792f@gmail.com","name":"flar2"},"message":"ElementalX governor version 2\n\nSigned-off-by: flar2 <asegaert@gmail.com>\n\n Conflicts:\n\tdrivers/cpufreq/cpufreq_governor.c\n\ncpufreq_elementalx: refactor and adjust\n\nSigned-off-by: flar2 <asegaert@gmail.com>\n\ncpufreq_elementalx: apply input boost per-cpu\n\nSuggested-by: franciscofranco <franciscofranco.1990@gmail.com>\n\nSigned-off-by: flar2 <asegaert@gmail.com>\n\ncpufreq_elementalx: increase max screen off freq\n\nSigned-off-by: flar2 <asegaert@gmail.com>\n\ncpufreq_elementalx: let input boost drop to lower frequency\n\nSigned-off-by: flar2 <asegaert@gmail.com>\n\ncpufreq_elementalx: disable input boost\n\nSigned-off-by: flar2 <asegaert@gmail.com>\n\ncpufreq_elementalx: replace input boost with down factor and floor frequency\n\nSigned-off-by: flar2 <asegaert@gmail.com>\n\ncpufreq_elementalx: tune and make less aggressive\n\nSigned-off-by: flar2 <asegaert@gmail.com>\n\ncpufreq_elementalx: pick next freq from freq tables\n\nSigned-off-by: flar2 <asegaert@gmail.com>\n\ncpufreq_elementalx: remove fb notifier\n\nSigned-off-by: flar2 <asegaert@gmail.com>\n\ncpufreq_elementalx: store freq_table per policy and add static reference tables\n\nThis makes the governor work properly with clusters\n\nSigned-off-by: flar2 <asegaert@gmail.com>\n\ncpufreq_elementalx: freq_table per policy and pass policy to init function\n\nSigned-off-by: flar2 <asegaert@gmail.com>\n\ncpufreq_elementalx: remove gboost\n\nWe don't need it on this device\n\nSigned-off-by: flar2 <asegaert@gmail.com>\n\ncpufreq_elementalx: add powersave mode and adjust freq tables\n\nSigned-off-by: flar2 <asegaert@gmail.com>\n\ncpufreq_elementalx: cache tunables\n\nThis ensures settings stick if a cluster goes offline or user switches governor\n\nSigned-off-by: flar2 <asegaert@gmail.com>\n\ncpufreq_elementalx: lower sampling_down_factor for big cluster\n\nAlso increase sampling rate to 20000","distinct":true,"url":"https://api.github.com/repos/kimjisoo/android_kernel_lge_bullhead/commits/04571c94e763ab7fd056f95fd8346a66d01be536"},{"sha":"a400bb44cddd149e2060a26899a9d238cff17464","author":{"email":"abcebd60d77c1ed0357577802de579d2f3d85a8e@gmail.com","name":"kimjisoo"},"message":"update defconfig for elementalx governor","distinct":true,"url":"https://api.github.com/repos/kimjisoo/android_kernel_lge_bullhead/commits/a400bb44cddd149e2060a26899a9d238cff17464"},{"sha":"a185ba2064767dfb2d4a5a559a24ab510210bc9c","author":{"email":"42480b5f4d505650064e5081b85d867a03559887@gmail.com","name":"franciscofranco"},"message":"wakeup: add toggle for bluedroid_timer wakelock\n\nBluetooth might stop working properly with this wakeup source disabled, but it might be useful for users affected by this apparent bug.\nBug-tracker: https://code.google.com/p/android/issues/detail?id=87778\n\nSigned-off-by: franciscofranco <franciscofranco.1990@gmail.com>","distinct":true,"url":"https://api.github.com/repos/kimjisoo/android_kernel_lge_bullhead/commits/a185ba2064767dfb2d4a5a559a24ab510210bc9c"},{"sha":"11f1d3c2a1d70719f7ec65c8a01ecdf4f58feb86","author":{"email":"50cb9bee76fd6567c3233b8a89e4a594c545792f@gmail.com","name":"flar2"},"message":"block IPA_WS wakelock","distinct":true,"url":"https://api.github.com/repos/kimjisoo/android_kernel_lge_bullhead/commits/11f1d3c2a1d70719f7ec65c8a01ecdf4f58feb86"},{"sha":"7340ff18648446bdb8b1e8e4d9b6192567d8ab7a","author":{"email":"50cb9bee76fd6567c3233b8a89e4a594c545792f@gmail.com","name":"flar2"},"message":"disable crc check\n\nSigned-off-by: flar2 <asegaert@gmail.com>","distinct":true,"url":"https://api.github.com/repos/kimjisoo/android_kernel_lge_bullhead/commits/7340ff18648446bdb8b1e8e4d9b6192567d8ab7a"},{"sha":"23ac5fa6417a98679629a2bd2ae76e4e0cf6ce7c","author":{"email":"42480b5f4d505650064e5081b85d867a03559887@gmail.com","name":"franciscofranco"},"message":"Added fsync on/off support.\n\nSigned-off-by: Francisco Franco <franciscofranco.1990@gmail.com>\nSigned-off-by: flar2 <asegaert@gmail.com>","distinct":true,"url":"https://api.github.com/repos/kimjisoo/android_kernel_lge_bullhead/commits/23ac5fa6417a98679629a2bd2ae76e4e0cf6ce7c"}]}