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>
This commit is contained in:

committed by
Quentin Perret

parent
f34f38632f
commit
4d1ac6a160
@@ -66,6 +66,8 @@
|
||||
#include <linux/cgroup.h>
|
||||
#include <linux/wait.h>
|
||||
|
||||
#include <trace/hooks/sched.h>
|
||||
|
||||
DEFINE_STATIC_KEY_FALSE(cpusets_pre_enable_key);
|
||||
DEFINE_STATIC_KEY_FALSE(cpusets_enabled_key);
|
||||
|
||||
@@ -1021,6 +1023,18 @@ void rebuild_sched_domains(void)
|
||||
put_online_cpus();
|
||||
}
|
||||
|
||||
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
|
||||
@@ -1036,7 +1050,7 @@ static void update_tasks_cpumask(struct cpuset *cs)
|
||||
|
||||
css_task_iter_start(&cs->css, 0, &it);
|
||||
while ((task = css_task_iter_next(&it)))
|
||||
set_cpus_allowed_ptr(task, cs->effective_cpus);
|
||||
update_cpus_allowed(cs, task, cs->effective_cpus);
|
||||
css_task_iter_end(&it);
|
||||
}
|
||||
|
||||
@@ -2188,7 +2202,7 @@ static void cpuset_attach(struct cgroup_taskset *tset)
|
||||
* 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_flag(cs, task);
|
||||
|
Reference in New Issue
Block a user