blob: 1e7c0a0811dee9290a4555cf07b673aa909262e1 [file] [log] [blame]
Chris Goldsworthy62e32cf2020-11-09 22:26:47 -08001/* SPDX-License-Identifier: GPL-2.0 */
2#undef TRACE_SYSTEM
3#define TRACE_SYSTEM mm
4
5#define TRACE_INCLUDE_PATH trace/hooks
6
7#if !defined(_TRACE_HOOK_MM_H) || defined(TRACE_HEADER_MULTI_READ)
8#define _TRACE_HOOK_MM_H
9
10#include <linux/types.h>
11
Chiawei Wang369de372021-02-18 10:43:50 +080012#include <linux/mm.h>
Prakash Gupta72488b32021-04-22 19:33:23 +053013#include <linux/oom.h>
Chris Goldsworthy62e32cf2020-11-09 22:26:47 -080014#include <linux/tracepoint.h>
15#include <trace/hooks/vendor_hooks.h>
16
Elliot Berman128b8a72021-04-07 09:40:55 -070017struct cma;
18
Chris Goldsworthy62e32cf2020-11-09 22:26:47 -080019DECLARE_RESTRICTED_HOOK(android_rvh_set_skip_swapcache_flags,
20 TP_PROTO(gfp_t *flags),
21 TP_ARGS(flags), 1);
22DECLARE_RESTRICTED_HOOK(android_rvh_set_gfp_zone_flags,
23 TP_PROTO(gfp_t *flags),
24 TP_ARGS(flags), 1);
25DECLARE_RESTRICTED_HOOK(android_rvh_set_readahead_gfp_mask,
26 TP_PROTO(gfp_t *flags),
27 TP_ARGS(flags), 1);
Minchan Kimc6e85ea2021-04-01 18:25:57 -070028DECLARE_HOOK(android_vh_cma_alloc_start,
29 TP_PROTO(s64 *ts),
30 TP_ARGS(ts));
31DECLARE_HOOK(android_vh_cma_alloc_finish,
32 TP_PROTO(struct cma *cma, struct page *page, unsigned long count,
33 unsigned int align, gfp_t gfp_mask, s64 ts),
34 TP_ARGS(cma, page, count, align, gfp_mask, ts));
Chiawei Wang369de372021-02-18 10:43:50 +080035DECLARE_HOOK(android_vh_rmqueue,
36 TP_PROTO(struct zone *preferred_zone, struct zone *zone,
37 unsigned int order, gfp_t gfp_flags,
38 unsigned int alloc_flags, int migratetype),
39 TP_ARGS(preferred_zone, zone, order,
40 gfp_flags, alloc_flags, migratetype));
Chiawei Wangdb158b42021-02-18 10:47:37 +080041DECLARE_HOOK(android_vh_pagecache_get_page,
42 TP_PROTO(struct address_space *mapping, pgoff_t index,
43 int fgp_flags, gfp_t gfp_mask, struct page *page),
44 TP_ARGS(mapping, index, fgp_flags, gfp_mask, page));
Liangliang Lida33f6f2021-06-08 10:00:02 +080045DECLARE_HOOK(android_vh_filemap_fault_get_page,
46 TP_PROTO(struct vm_fault *vmf, struct page **page, bool *retry),
47 TP_ARGS(vmf, page, retry));
48DECLARE_HOOK(android_vh_filemap_fault_cache_page,
49 TP_PROTO(struct vm_fault *vmf, struct page *page),
50 TP_ARGS(vmf, page));
Liujie Xie24149442021-03-11 20:40:06 +080051DECLARE_HOOK(android_vh_meminfo_proc_show,
52 TP_PROTO(struct seq_file *m),
53 TP_ARGS(m));
54DECLARE_HOOK(android_vh_exit_mm,
55 TP_PROTO(struct mm_struct *mm),
56 TP_ARGS(mm));
xieliujie0a24aff2021-07-02 00:06:46 +080057DECLARE_HOOK(android_vh_get_from_fragment_pool,
xieliujiedc524102021-05-06 20:12:24 +080058 TP_PROTO(struct mm_struct *mm, struct vm_unmapped_area_info *info,
59 unsigned long *addr),
60 TP_ARGS(mm, info, addr));
61DECLARE_HOOK(android_vh_exclude_reserved_zone,
62 TP_PROTO(struct mm_struct *mm, struct vm_unmapped_area_info *info),
63 TP_ARGS(mm, info));
xieliujie0a24aff2021-07-02 00:06:46 +080064DECLARE_HOOK(android_vh_include_reserved_zone,
xieliujiedc524102021-05-06 20:12:24 +080065 TP_PROTO(struct mm_struct *mm, struct vm_unmapped_area_info *info,
66 unsigned long *addr),
67 TP_ARGS(mm, info, addr));
Liujie Xie24149442021-03-11 20:40:06 +080068DECLARE_HOOK(android_vh_show_mem,
69 TP_PROTO(unsigned int filter, nodemask_t *nodemask),
70 TP_ARGS(filter, nodemask));
Liujie Xie24149442021-03-11 20:40:06 +080071struct slabinfo;
Yang Yang1b6f2f62021-05-13 19:28:11 +080072struct dirty_throttle_control;
73DECLARE_HOOK(android_vh_mm_dirty_limits,
74 TP_PROTO(struct dirty_throttle_control *const gdtc, bool strictlimit,
75 unsigned long dirty, unsigned long bg_thresh,
76 unsigned long nr_reclaimable, unsigned long pages_dirtied),
77 TP_ARGS(gdtc, strictlimit, dirty, bg_thresh,
78 nr_reclaimable, pages_dirtied));
Prakash Gupta72488b32021-04-22 19:33:23 +053079DECLARE_HOOK(android_vh_oom_check_panic,
80 TP_PROTO(struct oom_control *oc, int *ret),
81 TP_ARGS(oc, ret));
Liujie Xie8bc63372021-05-11 19:05:32 +080082DECLARE_HOOK(android_vh_save_vmalloc_stack,
83 TP_PROTO(unsigned long flags, struct vm_struct *vm),
84 TP_ARGS(flags, vm));
85DECLARE_HOOK(android_vh_show_stack_hash,
86 TP_PROTO(struct seq_file *m, struct vm_struct *v),
87 TP_ARGS(m, v));
88DECLARE_HOOK(android_vh_save_track_hash,
Liujie Xie7d216e22021-06-24 10:10:14 +080089 TP_PROTO(bool alloc, unsigned long p),
90 TP_ARGS(alloc, p));
Liangliang Li444a0b72021-06-21 20:32:49 +080091struct mem_cgroup;
92DECLARE_HOOK(android_vh_vmpressure,
93 TP_PROTO(struct mem_cgroup *memcg, bool *bypass),
94 TP_ARGS(memcg, bypass));
Liujie Xie1cdcf762021-07-03 12:09:04 +080095DECLARE_HOOK(android_vh_mem_cgroup_alloc,
96 TP_PROTO(struct mem_cgroup *memcg),
97 TP_ARGS(memcg));
98DECLARE_HOOK(android_vh_mem_cgroup_free,
99 TP_PROTO(struct mem_cgroup *memcg),
100 TP_ARGS(memcg));
101DECLARE_HOOK(android_vh_mem_cgroup_id_remove,
102 TP_PROTO(struct mem_cgroup *memcg),
103 TP_ARGS(memcg));
104struct cgroup_subsys_state;
105DECLARE_HOOK(android_vh_mem_cgroup_css_online,
106 TP_PROTO(struct cgroup_subsys_state *css, struct mem_cgroup *memcg),
107 TP_ARGS(css, memcg));
108DECLARE_HOOK(android_vh_mem_cgroup_css_offline,
109 TP_PROTO(struct cgroup_subsys_state *css, struct mem_cgroup *memcg),
110 TP_ARGS(css, memcg));
Liujie Xie94fbab92021-08-25 02:26:18 +0800111DECLARE_HOOK(android_vh_kmalloc_slab,
112 TP_PROTO(unsigned int index, gfp_t flags, struct kmem_cache **s),
113 TP_ARGS(index, flags, s));
Jiewen Wang878e0ca2021-09-06 16:50:35 +0800114DECLARE_HOOK(android_vh_mmap_region,
115 TP_PROTO(struct vm_area_struct *vma, unsigned long addr),
116 TP_ARGS(vma, addr));
Jiewen Wang955f9172021-09-06 16:55:03 +0800117DECLARE_HOOK(android_vh_try_to_unmap_one,
118 TP_PROTO(struct vm_area_struct *vma, struct page *page, unsigned long addr, bool ret),
119 TP_ARGS(vma, page, addr, ret));
Chris Goldsworthy84fc3ab2021-12-09 14:47:35 -0800120struct device;
121DECLARE_HOOK(android_vh_subpage_dma_contig_alloc,
122 TP_PROTO(bool *allow_subpage_alloc, struct device *dev, size_t *size),
123 TP_ARGS(allow_subpage_alloc, dev, size));
Todd Kjos10fc8b22021-01-26 13:57:52 -0800124/* macro versions of hooks are no longer required */
Chris Goldsworthy62e32cf2020-11-09 22:26:47 -0800125
126#endif /* _TRACE_HOOK_MM_H */
127
128/* This part must be outside protection */
129#include <trace/define_trace.h>