Commit Graph

34 Commits

Author SHA1 Message Date
Rick Yiu
4b88cf8524 ANDROID: sched: Add vendor hook for uclamp_eff_value
Vendor may have their own behavior for determing uclamp value.

Bug: 170507972
Signed-off-by: Rick Yiu <rickyiu@google.com>
Change-Id: I33f8adc7240f6a44f16446421536047db2794989
2021-03-05 13:08:32 +00:00
Namkyu Kim
97368fc2dc ANDROID: Add a vendor hook that allow a module to modify the wake flag
android_vh_do_wake_up_sync:
  To modify the mode value of __wake_up_sync_key

 android_vh_set_wake_flags:
  To modify the wake flag from a module

Bug: 181743516
Signed-off-by: Namkyu Kim <namkyu78.kim@samsung.com>
Change-Id: I972e2469c3f139373d21f1e8c85974763388a693
2021-03-04 16:19:04 +00:00
Rick Yiu
f5998fbf2d ANDROID: sched: Add vendor hook for cpu_overutilized
Currently, cpu_overutilized uses the threshold 80% of cpu capacity, Add
vendor hook so that vendor could define other values.

Bug: 176722431
Signed-off-by: Rick Yiu <rickyiu@google.com>
Change-Id: Ic10bd8ebb40f7321cfa10e33ac020e3347ca6550
(cherry picked from commit b199c6e8795791e008cfff6e214676857cd0651c)
Signed-off-by: J. Avila <elavila@google.com>
2021-02-26 20:34:34 +00:00
Pavankumar Kondeti
a56f081c5b ANDROID: sched: Add restricted vendor hooks in CFS scheduler
Add restricted vendor hooks in CFS scheduler class to allow
customizations in vendor modules.

Bug: 180668820
Change-Id: I69bd90e11220d7607b075a3aa687059deaa60439
Signed-off-by: Pavankumar Kondeti <quic_pkondeti@quicinc.com>
2021-02-19 12:22:57 +05:30
Sangmoon Kim
18ebdc3746 ANDROID: sched: add vendor hooks for bad scheduling
Add hooks to gather data of bad scheduling and summarize it with
other information.

Bug: 177483057

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I08a7097b60dd8eebc5c0205b31c463a36f576121
2021-02-04 23:56:20 +00:00
Pavankumar Kondeti
4b5f345c73 ANDROID: sched: Add restrict vendor hooks for balance_rt()
Add rvh called android_rvh_sched_balance_rt to influence
balance_rt() from vendor modules.

Bug: 178572414
Change-Id: I555c8ebcf5a3a5d8e3ab881ab9aa507f325285c2
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2021-01-28 08:48:23 +00:00
Yun Hsiang
18b294fa4c ANDROID: sched: add em_cpu_energy vendor hook
We add a vendor hook for util to freq calculation in schedutil,
so we need to do corresponding change for energy calculation.

android_vh_em_cpu_energy
	adjust energy calculation

Bug: 178047619

Signed-off-by: Yun Hsiang <yun.hsiang@mediatek.com>
Change-Id: Iae772cf07881602eea3f27aeb75fba753e7c2635
2021-01-21 08:38:56 -08:00
Yun Hsiang
11d9d07f3f ANDROID: schedutil: add vendor hook for adjusting util to freq calculation
Currently, the frequency is calculated by max freq * 1.25 * util / max cap.
Add a vendor hook to adjust the frequency when the calculation
overestimate.

android_vh_map_util_freq
	adjust util to freq calculation

Bug: 177854431

Signed-off-by: Yun Hsiang <yun.hsiang@mediatek.com>
Change-Id: I9aa9079f00af7d3380b19f2fe21b75cddd107d15
(cherry picked from commit 3122e3ec9672036384304fdeaa1b1815f60ba817)
2021-01-19 20:33:51 +00:00
Park Bumgyu
e0db4801be ANDROID: sched: add rvh for rebalance domains
Vendor scheduler may not want to rebalance between domains in some case.
New vendor hook is added for vendor to decide whether rebalance domains.

Bug: 176952463

Change-Id: Ie2edbd4b11679786096dd0170496904ae180583c
Signed-off-by: Park Bumgyu <bumgyu.park@samsung.com>
2021-01-19 15:39:05 +00:00
Todd Kjos
ba75b92fef ANDROID: simplify vendor hooks for non-GKI builds
Vendor hooks required explicitly defining macros or inline functions
to handle the non-GKI build case (!CONFIG_ANDROID_VENDOR_HOOKS). Added
support for generating them automatically so the macros are no longer
required.

Both models are now supported so we can transition.

Bug: 177416721
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I01acc389d315a5d509b0c48116854342a42e1058
2021-01-14 11:00:32 -08:00
Todd Kjos
cb5a049748 ANDROID: fix 0-day bot build-break in fair.c
Fix an issue for non-GKI builds found by the 0-day test bot:

kernel/sched/fair.c: In function 'select_task_rq_fair':
>> kernel/sched/fair.c:6766:6: error: implicit declaration of function
	'trace_android_rvh_select_task_rq_fair_enabled';
	did you mean 'trace_android_rvh_select_task_rq_fair'?
    6766 |  if (trace_android_rvh_select_task_rq_fair_enabled())
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |      trace_android_rvh_select_task_rq_fair
   cc1: some warnings being treated as errors

Reported-by: kernel test robot <lkp@intel.com>
Fixes: c7ba09ce6a ("ANDROID: sched/fair: Sync task util for strf hook")
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: I1b15b9ada83dc5b2678cef3910a7aedc0d19f174
2021-01-13 08:52:54 +00:00
Park Bumgyu
f9ebdfbf70 ANDROID: add flags to android_rvh_enqueue_task/dequeue_task parameter
"flags" is added to the vendor hook parameter so that the module can know
the event type of task enqueue/dequeue.

Bug: 176917922

Signed-off-by: Park Bumgyu <bumgyu.park@samsung.com>
Change-Id: I7cc60908e301d75393bdf84861878a94de80d683
2021-01-08 16:46:20 +00:00
Shaleen Agrawal
1feedbd763 ANDROID: Sched: Add hooks for scheduler
Add vendors hooks for to facilitate various scheduler value adds.

Bug: 176077958
Change-Id: I5d488ae78ce05f81e6c73b69c56128b065647fec
Signed-off-by: Shaleen Agrawal <shalagra@codeaurora.org>
2021-01-08 02:01:31 +00:00
Satya Durga Srinivasu Prabhala
598670e2d0 ANDROID: sched: add trace hook to enable EAS for SMP systems
At present, EAS gets disabled when on ASYM Capacity systems
if all BIG or Little CPUs gets hot-plugged. Instead of disabling
EAS by default, add trace hook and let vendor decide if EAS should
be disabled or not.

Bug: 176964092
Change-Id: I583272cc89d44f3e3a4b1c43e3f75d731092ebf6
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
2021-01-07 22:34:23 +00:00
Choonghoon Park
d3092d8afd ANDROID: sched: Add rvh for cpu controller cgroup can attach
Add a restricted vendor hook to check whether a set of tasks can
move to other cgorup.

Bug: 175808144

Signed-off-by: Choonghoon Park <choong.park@samsung.com>
Change-Id: If7bac83e0d2d1069b1436331989c3926645eab19
2020-12-21 16:37:22 +00:00
Satya Durga Srinivasu Prabhala
d31ea0950a ANDROID: sched/fair: fix place_entity() vendor hook
place_entity() vendor hook is meant to tweak vruntime by vendor
modules as needed, but with current form of the hook that is not
possible as vruntime is passed by it's value. Fix it by switching
to pass by reference.

Bug: 175448877
Change-Id: Ibb51592f94da31019fa98a6767d080ec61daafe6
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
2020-12-14 18:00:22 +00:00
Abhijeet Dharmapurikar
5fed80f580 ANDROID: sched: Add rvh for cpu controller cgroup attach
Add a restricted vendor hook when a set of tasks change the cgroups in
the cpu controller. This facilitates various scheduler value adds.

Bug: 175045928
Change-Id: I544046d631f4d6c9bc2b999e054b5a296ec31a81
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2020-12-10 18:12:07 +00:00
Stephen Dickey
782131fed0 ANDROID: cpu/hotplug: vendor hook for resume cpus
Incorporate a vendor hook in the resume cpus path
so that vendor specific activities may take place.

Bug: 161210528
Change-Id: I74d03247491b004e891dbcfe06a478d00a95ba9f
Signed-off-by: Stephen Dickey <dickey@codeaurora.org>
2020-12-08 19:09:34 +00:00
Shaleen Agrawal
292f430816 ANDROID: Sched: Add restricted vendor hooks for scheduler
Add vendors hooks for to facilitate various scheduler value adds.

Bug: 173725277
Change-Id: I4389f2a8121fe7ac49ad4610e25a77bfc38f4660
Signed-off-by: Shaleen Agrawal <shalagra@codeaurora.org>
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2020-12-03 19:20:26 +00:00
Satya Durga Srinivasu Prabhala
4d1ac6a160 ANDROID: sched/cpuset: Add vendor hook to change tasks affinity
Vendors might want to change tasks affinity settings when they are
moving from one cpuset into the other. Add vendor hook to give control
to vendor to implement what they need.

Bug: 174125747
Change-Id: Icee0405be0bca432002dae4a26ebe945082ce052
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
2020-11-30 14:28:11 +00:00
Satya Durga Srinivasu Prabhala
f34f38632f ANDROID: sched/core: Add vendor hook to change task affinity
Vendors might want to change tasks affinity settings when they are
moving from one cpuset into the other. Add vendor hook to give control
to vendor to implement what they need in sched_setaffinity().

Bug: 174125747
Change-Id: Ie703448147377cd62e76a58b620a7ab849a04924
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
2020-11-30 14:27:59 +00:00
Wei Wang
846bf8e8cb ANDROID: sched: Add vendor hooks for skipping sugov update
This is to add capability for vendor to decide whether a cpufreq update
is needed, e.g. up/down rate limit.

Using restricted hook since it can be called from scheduler wakeup path.

Bug: 170511085
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: If9adea3a3e31efbf3858fbd009665a07dc70c638
(cherry picked from commit f9f3464532a045257f8138338b1beda86ef0a3be)
Signed-off-by: Will McVicker <willmcvicker@google.com>
2020-11-27 16:25:31 +00:00
Wei Wang
06881e01b5 ANDROID: sched: Add vendor hooks for override sugov behavior
Upstream moved the sugov to DEADLINE class which has higher prio than RT
so it can potentially block many RT use case in Android.

Also currently iowait doesn't distinguish background/foreground tasks
and we have seen cases where device run to high frequency unnecessarily
when running some background I/O.

Bug: 171598214
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: I21e9bfe9ef75a4178279574389e417c3f38e65ac
(cherry picked from commit 03177ef82bd942a3f163e826063491bae6ff0ac9)
Signed-off-by: Will McVicker <willmcvicker@google.com>
2020-11-27 16:25:08 +00:00
Rick Yiu
147a9b3d9e ANDROID: sched: Add vendor hooks for find_energy_efficient_cpu
Add hooks for vendor specific find_energy_efficient_cpu logic.

Bug: 170507310
Signed-off-by: Rick Yiu <rickyiu@google.com>
Change-Id: I064b501017e32d4f22f8128bed8bf3a1508ab15b
(cherry picked from commit 2f108e2ec6e89609cbae32c5d13d6ad9f2e858cb)
Signed-off-by: Will McVicker <willmcvicker@google.com>
2020-11-27 16:21:19 +00:00
Pavankumar Kondeti
dc543a5b2a ANDROID: sched: Add env->cpus to android_rvh_sched_nohz_balancer_kick
android_rvh_sched_nohz_balancer_kick hook allows vendor modules to
select the busiest CPU in a group during load balance. When the
load balancer could not pull tasks from this busiest CPU due to
affinity restriction, the CPU is cleared from env->cpu. This must
be passed to the vendor module, otherwise we keep selecting the
exempted CPU as the busiest CPU.

Bug: 174338902
Change-Id: Iedaa389a51849da4c3e094d731fe5e39cd909d81
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2020-11-27 13:54:33 +00:00
Pavankumar Kondeti
878495dacd ANDROID: sched: Add restrict vendor hooks for load balance
The following restrict vendor hooks are added. The vendor hook
can selectively opt in for the default scheduler behavior by not
modifying the done argument.

- android_rvh_sched_newidle_balance: For newly idle load balance.

- android_rvh_sched_nohz_balancer_kick: For deciding if an idle
CPU is woken up to do nohz balance or not.

- android_rvh_find_busiest_queue: For selecting the busiest runqueue
among the CPUs in the busiest group selected in find_busiest_group.

- android_rvh_migrate_queued_task: Vendor implementations may require
both source and destination CPUs runqueue locks to be held while
calling set_task_cpu() during a task migration. Add a hook when
a queued task is migration so that vendor implementation can detach
the task and call set_task_cpu() with both runqueue locks held.

Bug: 173661641
Change-Id: I6a09226081061b6433e4231359be252a0f28f04b
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2020-11-24 01:27:26 +00:00
Satya Durga Srinivasu Prabhala
ebce8ec6bd ANDROID: sched: rt: rearrange invocation of find_lowest_rq() vendor hook
Right now, invocation of find_lowest_rq() vendor hook is made before
error checks and also, cpupri_find() isn't exported either. It would be
appropriate to move invocation of find_lowest_rq() vendor hook after
error checks are done & calling cpupri_find().

Bug: 173559623
Change-Id: I298dffd39be0451b0b154930ace4e16763c6e78d
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
2020-11-20 09:46:29 +00:00
Amir Vajid
9bdaa3fa87 ANDROID: vendor_hooks: Add hook for jiffies updates
Create a vendor hook for jiffies updates by the
tick_do_timer_cpu.

Bug: 148928265
Change-Id: Ia442e20d446b8ce4f2b3f2be76655e72919c76eb
Signed-off-by: Amir Vajid <avajid@codeaurora.org>
2020-11-10 21:50:56 +00:00
Sai Harshini Nimmala
bf3d991a7d ANDROID: sched: Add trace hook for rt throttle dump
Create a trace hook when RT tasks are throttled. This allows
vendors to debug long RT runs.

Bug: 172264047
Change-Id: I534959f8e8d714463aac2f9f1c5627d2e735f543
Signed-off-by: Sai Harshini Nimmala <snimmala@codeaurora.org>
2020-11-05 19:50:27 +00:00
YT Chang
a2ca8408de ANDROID: sched: add restrict vendor hook to modify load balance behavior
For modifying load balance policy, we add the hook on
find_busiest_group().
It allows us to modify load balance paths.

Bug: 168248326
Signed-off-by: YT Chang <yt.chang@mediatek.com>
Change-Id: I77ec043576139806551b978eb1bdf9f637442dfb
2020-09-11 01:47:17 +00:00
JianMin Liu
2935d588b1 ANDROID: sched: Use normal vendor hook in scheduler tick
The hooks function of scheduler tick will need to
  insert multiple instances, so that use vendor hook
  instead of restricted vendor hook.

Bug: 165787557

Signed-off-by: JianMin Liu <jian-min.liu@mediatek.com>
Change-Id: I750da26452c657d83d5f8c520bf7008693c43a6b
2020-08-20 19:41:06 +00:00
JianMin Liu
f39f3ac200 ANDROID: sched: add vendor hooks to handle scheduling priority
Add hooks to collect scheduling information and apply vendor's
tuning when task's scheduling priority is changed

Bug: 163431711

Signed-off-by: JianMin Liu <jian-min.liu@mediatek.com>
Change-Id: Ic85835852690d0060666107d9108560f5023496b
2020-08-12 17:29:18 +00:00
Park Bumgyu
16330b3560 ANDROID: Add vendor hooks to the scheduler
Add vendor hooks for vendor-specific scheduling.

  android_rvh_select_task_rq_rt:
    To perform vendor-specific RT task placement.

  android_rvh_select_fallback_rq:
    To restrict cpu usage.

  android_rvh_scheduler_tick:
    To collect periodic scheduling information and to schedule tasks.

  android_rvh_enqueue_tas/android_rvh_dequeue_task:
    For vendor to be aware of the task schedule in/out.

  android_rvh_can_migrate_task:
    To limit task migration based on vendor requirements.

  android_rvh_find_lowest_rq:
    To find the lowest rq for RT task with vendor-specific way.

Bug: 155241766

Change-Id: I926458b0a911d564e5932e200125b12406c2deee
Signed-off-by: Park Bumgyu <bumgyu.park@samsung.com>
2020-07-17 14:38:05 +00:00
Yun Hsiang
a1fc1fba46 ANDROID: sched: add restrict vendor hook to modify task placement policy in EAS
For modifying task placement policy, we add the hook on the top of
select_task_rq_fair(). It allows us to modify wakeup/fork/exec balance
paths.

Bug: 158263250
Signed-off-by: Yun Hsiang <yun.hsiang@mediatek.com>
Change-Id: I80ff870453472e183ab2aae7381bff91e49ae296
2020-07-10 06:54:27 +00:00