ANDROID: cgroup: Add vendor hook for cpuset.

add vendor hook for cpuset to support oem's feature.

Bug: 183674818
Signed-off-by: lijianzhong <lijianzhong@xiaomi.com>
Change-Id: Ib93e05e5f6c338c5f7ada56bfebdd705f87f1f66
This commit is contained in:
lijianzhong 2021-03-23 20:31:45 +08:00 committed by Todd Kjos
commit 295ce88224
3 changed files with 9 additions and 1 deletions

View file

@ -246,3 +246,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_scan_type);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_swappiness);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psi_event);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psi_group);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpuset_fork);

View file

@ -12,6 +12,9 @@ struct task_struct;
DECLARE_HOOK(android_vh_cgroup_set_task,
TP_PROTO(int ret, struct task_struct *task),
TP_ARGS(ret, task));
DECLARE_RESTRICTED_HOOK(android_rvh_cpuset_fork,
TP_PROTO(struct task_struct *p, int *inherit_cpus),
TP_ARGS(p, inherit_cpus), 1);
#endif
#include <trace/define_trace.h>

View file

@ -67,6 +67,7 @@
#include <linux/wait.h>
#include <trace/hooks/sched.h>
#include <trace/hooks/cgroup.h>
DEFINE_STATIC_KEY_FALSE(cpusets_pre_enable_key);
DEFINE_STATIC_KEY_FALSE(cpusets_enabled_key);
@ -2902,10 +2903,13 @@ static void cpuset_bind(struct cgroup_subsys_state *root_css)
*/
static void cpuset_fork(struct task_struct *task)
{
int inherit_cpus = 0;
if (task_css_is_root(task, cpuset_cgrp_id))
return;
set_cpus_allowed_ptr(task, current->cpus_ptr);
trace_android_rvh_cpuset_fork(task, &inherit_cpus);
if (!inherit_cpus)
set_cpus_allowed_ptr(task, current->cpus_ptr);
task->mems_allowed = current->mems_allowed;
}