ANDROID: cgroup: Add vendor hook for cpuset.
This hook allows us to capture information when a process is forked so that we can stat and set some key task's CPU affinity in the ko module later. This patch, along with aosp/2548175, is necessary for our affinity settings. Bug: 425550656 Bug: 339371220 Bug: 183674818 Signed-off-by: lijianzhong <lijianzhong@xiaomi.com> Change-Id: Ib93e05e5f6c338c5f7ada56bfebdd705f87f1f66 (cherry picked from commit a188361628461c58a4dfc72869d9acb1dfa2542f) (cherry picked from commit 02992f5b8d68424ba34e1f905c3bde3b72aade88)
This commit is contained in:
committed by
Treehugger Robot
parent
478166f75c
commit
5111c39916
@@ -567,3 +567,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_pr_set_vma_name_bypass);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mem_cgroup_charge);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_filemap_add_folio);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_shrink_node);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpuset_fork);
|
||||
|
||||
@@ -19,6 +19,10 @@ DECLARE_HOOK(android_vh_cgroup_attach,
|
||||
TP_PROTO(struct cgroup_subsys *ss, struct cgroup_taskset *tset),
|
||||
TP_ARGS(ss, tset));
|
||||
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_cpuset_fork,
|
||||
TP_PROTO(struct task_struct *p, bool *inherit_cpus),
|
||||
TP_ARGS(p, inherit_cpus), 1);
|
||||
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_cpu_cgroup_attach,
|
||||
TP_PROTO(struct cgroup_taskset *tset),
|
||||
TP_ARGS(tset), 1);
|
||||
|
||||
@@ -43,6 +43,8 @@
|
||||
#include <linux/workqueue.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);
|
||||
|
||||
@@ -3614,18 +3616,18 @@ static void cpuset_cancel_fork(struct task_struct *task, struct css_set *cset)
|
||||
static void cpuset_fork(struct task_struct *task)
|
||||
{
|
||||
struct cpuset *cs;
|
||||
bool same_cs;
|
||||
bool same_cs, inherit_cpus = false;
|
||||
|
||||
rcu_read_lock();
|
||||
cs = task_cs(task);
|
||||
same_cs = (cs == task_cs(current));
|
||||
rcu_read_unlock();
|
||||
|
||||
if (same_cs) {
|
||||
if (cs == &top_cpuset)
|
||||
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;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user