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. This reverts commit a42f6e7d0aa0("Revert "ANDROID: sched/cpuset: Add vendor hook to change tasks affinity"") to effectively bring back the original change. Bug: 323765868 Change-Id: I47c1ee0dabda491732932c653bd80e95ee550791 Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org> Signed-off-by: Sai Harshini Nimmala <quic_snimmala@quicinc.com>
This commit is contained in:
parent
18c75fa402
commit
77277e4ba4
@ -207,6 +207,11 @@ DECLARE_RESTRICTED_HOOK(android_rvh_util_fits_cpu,
|
||||
int cpu, bool *fits, bool *done),
|
||||
TP_ARGS(util, uclamp_min, uclamp_max, cpu, fits, done), 1);
|
||||
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_update_cpus_allowed,
|
||||
TP_PROTO(struct task_struct *p, cpumask_var_t cpus_requested,
|
||||
const struct cpumask *new_mask, int *ret),
|
||||
TP_ARGS(p, cpus_requested, new_mask, ret), 1);
|
||||
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_sched_fork_init,
|
||||
TP_PROTO(struct task_struct *p),
|
||||
TP_ARGS(p), 1);
|
||||
|
@ -68,6 +68,7 @@
|
||||
#include <linux/wait.h>
|
||||
|
||||
#include <trace/hooks/cgroup.h>
|
||||
#include <trace/hooks/sched.h>
|
||||
|
||||
DEFINE_STATIC_KEY_FALSE(cpusets_pre_enable_key);
|
||||
DEFINE_STATIC_KEY_FALSE(cpusets_enabled_key);
|
||||
@ -1241,6 +1242,18 @@ void rebuild_sched_domains(void)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rebuild_sched_domains);
|
||||
|
||||
static int update_cpus_allowed(struct cpuset *cs, struct task_struct *p,
|
||||
const struct cpumask *new_mask)
|
||||
{
|
||||
int ret = -EINVAL;
|
||||
|
||||
trace_android_rvh_update_cpus_allowed(p, cs->cpus_requested, new_mask, &ret);
|
||||
if (!ret)
|
||||
return ret;
|
||||
|
||||
return set_cpus_allowed_ptr(p, new_mask);
|
||||
}
|
||||
|
||||
/**
|
||||
* update_tasks_cpumask - Update the cpumasks of tasks in the cpuset.
|
||||
* @cs: the cpuset in which each task's cpus_allowed mask needs to be changed
|
||||
@ -1267,7 +1280,7 @@ static void update_tasks_cpumask(struct cpuset *cs, struct cpumask *new_cpus)
|
||||
|
||||
cpumask_and(new_cpus, cs->effective_cpus,
|
||||
task_cpu_possible_mask(task));
|
||||
set_cpus_allowed_ptr(task, new_cpus);
|
||||
update_cpus_allowed(cs, task, new_cpus);
|
||||
}
|
||||
css_task_iter_end(&it);
|
||||
}
|
||||
@ -2640,7 +2653,7 @@ static void cpuset_attach_task(struct cpuset *cs, struct task_struct *task)
|
||||
* can_attach beforehand should guarantee that this doesn't
|
||||
* fail. TODO: have a better way to handle failure here
|
||||
*/
|
||||
WARN_ON_ONCE(set_cpus_allowed_ptr(task, cpus_attach));
|
||||
WARN_ON_ONCE(update_cpus_allowed(cs, task, cpus_attach));
|
||||
|
||||
cpuset_change_task_nodemask(task, &cpuset_attach_nodemask_to);
|
||||
cpuset_update_task_spread_flags(cs, task);
|
||||
|
@ -37,6 +37,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_find_busiest_queue);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_migrate_queued_task);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpu_overutilized);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_sched_setaffinity);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_update_cpus_allowed);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_build_sched_domains);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_check_preempt_tick);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_check_preempt_wakeup_ignore);
|
||||
|
Loading…
Reference in New Issue
Block a user