Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4b22a632 authored by Frankie Chang's avatar Frankie Chang Committed by Todd Kjos
Browse files

ANDROID: cgroup: Add vendor hook to the cgroup



Add a vendor hook after attaching a task to a cgroup to 
recognize the group_id for performance tuning

Bug: 181917687

Signed-off-by: default avatarFrankie Chang <frankie.chang@mediatek.com>
Change-Id: I603afa3d893dd575a7dcb97f83bd9eacb8315bab
(cherry picked from commit bed1e2a75b0000d99a00177272b93e5c8430308b)
parent 47c864ea
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@
#include <trace/hooks/minidump.h>
#include <trace/hooks/minidump.h>
#include <trace/hooks/wqlockup.h>
#include <trace/hooks/wqlockup.h>
#include <trace/hooks/sysrqcrash.h>
#include <trace/hooks/sysrqcrash.h>
#include <trace/hooks/cgroup.h>


/*
/*
 * Export tracepoints that act as a bare tracehook (ie: have no trace event
 * Export tracepoints that act as a bare tracehook (ie: have no trace event
@@ -69,3 +70,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sysrq_crash);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_find_busiest_group);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_find_busiest_group);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_map_util_freq);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_map_util_freq);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_em_pd_energy);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_em_pd_energy);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cgroup_set_task);
+17 −0
Original line number Original line Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM cgroup
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_CGROUP_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_CGROUP_H
#include <linux/tracepoint.h>
#include <trace/hooks/vendor_hooks.h>

struct task_struct;
DECLARE_HOOK(android_vh_cgroup_set_task,
	TP_PROTO(int ret, struct task_struct *task),
	TP_ARGS(ret, task));
#endif

#include <trace/define_trace.h>
+2 −0
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
#include <linux/fs_parser.h>
#include <linux/fs_parser.h>


#include <trace/events/cgroup.h>
#include <trace/events/cgroup.h>
#include <trace/hooks/cgroup.h>


#define cg_invalf(fc, fmt, ...) invalf(fc, fmt, ## __VA_ARGS__)
#define cg_invalf(fc, fmt, ...) invalf(fc, fmt, ## __VA_ARGS__)


@@ -522,6 +523,7 @@ static ssize_t __cgroup1_procs_write(struct kernfs_open_file *of,
		goto out_finish;
		goto out_finish;


	ret = cgroup_attach_task(cgrp, task, threadgroup);
	ret = cgroup_attach_task(cgrp, task, threadgroup);
	trace_android_vh_cgroup_set_task(ret, task);


out_finish:
out_finish:
	cgroup_procs_write_finish(task);
	cgroup_procs_write_finish(task);