mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
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: 183674818 Signed-off-by: lijianzhong <lijianzhong@xiaomi.com> Change-Id: Ib93e05e5f6c338c5f7ada56bfebdd705f87f1f66 (cherry picked from commit a188361628461c58a4dfc72869d9acb1dfa2542f)
This commit is contained in:
@@ -229,4 +229,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_read_done);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_preset);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_uid);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_user);
|
||||
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpuset_fork);
|
||||
|
||||
@@ -24,6 +24,10 @@ DECLARE_RESTRICTED_HOOK(android_rvh_cgroup_force_kthread_migration,
|
||||
struct cgroup_taskset;
|
||||
struct cgroup_subsys;
|
||||
|
||||
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);
|
||||
|
||||
@@ -67,6 +67,8 @@
|
||||
#include <linux/cgroup.h>
|
||||
#include <linux/wait.h>
|
||||
|
||||
#include <trace/hooks/cgroup.h>
|
||||
|
||||
DEFINE_STATIC_KEY_FALSE(cpusets_pre_enable_key);
|
||||
DEFINE_STATIC_KEY_FALSE(cpusets_enabled_key);
|
||||
|
||||
@@ -3315,18 +3317,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