Chris Goldsworthy | 62e32cf | 2020-11-09 22:26:47 -0800 | [diff] [blame] | 1 | /* 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 Wang | 369de37 | 2021-02-18 10:43:50 +0800 | [diff] [blame] | 12 | #include <linux/mm.h> |
Prakash Gupta | 72488b3 | 2021-04-22 19:33:23 +0530 | [diff] [blame] | 13 | #include <linux/oom.h> |
Chris Goldsworthy | 62e32cf | 2020-11-09 22:26:47 -0800 | [diff] [blame] | 14 | #include <linux/tracepoint.h> |
| 15 | #include <trace/hooks/vendor_hooks.h> |
| 16 | |
Elliot Berman | 128b8a7 | 2021-04-07 09:40:55 -0700 | [diff] [blame] | 17 | struct cma; |
| 18 | |
Chris Goldsworthy | 62e32cf | 2020-11-09 22:26:47 -0800 | [diff] [blame] | 19 | DECLARE_RESTRICTED_HOOK(android_rvh_set_skip_swapcache_flags, |
| 20 | TP_PROTO(gfp_t *flags), |
| 21 | TP_ARGS(flags), 1); |
| 22 | DECLARE_RESTRICTED_HOOK(android_rvh_set_gfp_zone_flags, |
| 23 | TP_PROTO(gfp_t *flags), |
| 24 | TP_ARGS(flags), 1); |
| 25 | DECLARE_RESTRICTED_HOOK(android_rvh_set_readahead_gfp_mask, |
| 26 | TP_PROTO(gfp_t *flags), |
| 27 | TP_ARGS(flags), 1); |
Minchan Kim | c6e85ea | 2021-04-01 18:25:57 -0700 | [diff] [blame] | 28 | DECLARE_HOOK(android_vh_cma_alloc_start, |
| 29 | TP_PROTO(s64 *ts), |
| 30 | TP_ARGS(ts)); |
| 31 | DECLARE_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 Wang | 369de37 | 2021-02-18 10:43:50 +0800 | [diff] [blame] | 35 | DECLARE_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 Wang | db158b4 | 2021-02-18 10:47:37 +0800 | [diff] [blame] | 41 | DECLARE_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 Li | da33f6f | 2021-06-08 10:00:02 +0800 | [diff] [blame] | 45 | DECLARE_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)); |
| 48 | DECLARE_HOOK(android_vh_filemap_fault_cache_page, |
| 49 | TP_PROTO(struct vm_fault *vmf, struct page *page), |
| 50 | TP_ARGS(vmf, page)); |
Liujie Xie | 2414944 | 2021-03-11 20:40:06 +0800 | [diff] [blame] | 51 | DECLARE_HOOK(android_vh_meminfo_proc_show, |
| 52 | TP_PROTO(struct seq_file *m), |
| 53 | TP_ARGS(m)); |
| 54 | DECLARE_HOOK(android_vh_exit_mm, |
| 55 | TP_PROTO(struct mm_struct *mm), |
| 56 | TP_ARGS(mm)); |
xieliujie | 0a24aff | 2021-07-02 00:06:46 +0800 | [diff] [blame] | 57 | DECLARE_HOOK(android_vh_get_from_fragment_pool, |
xieliujie | dc52410 | 2021-05-06 20:12:24 +0800 | [diff] [blame] | 58 | TP_PROTO(struct mm_struct *mm, struct vm_unmapped_area_info *info, |
| 59 | unsigned long *addr), |
| 60 | TP_ARGS(mm, info, addr)); |
| 61 | DECLARE_HOOK(android_vh_exclude_reserved_zone, |
| 62 | TP_PROTO(struct mm_struct *mm, struct vm_unmapped_area_info *info), |
| 63 | TP_ARGS(mm, info)); |
xieliujie | 0a24aff | 2021-07-02 00:06:46 +0800 | [diff] [blame] | 64 | DECLARE_HOOK(android_vh_include_reserved_zone, |
xieliujie | dc52410 | 2021-05-06 20:12:24 +0800 | [diff] [blame] | 65 | TP_PROTO(struct mm_struct *mm, struct vm_unmapped_area_info *info, |
| 66 | unsigned long *addr), |
| 67 | TP_ARGS(mm, info, addr)); |
Liujie Xie | 2414944 | 2021-03-11 20:40:06 +0800 | [diff] [blame] | 68 | DECLARE_HOOK(android_vh_show_mem, |
| 69 | TP_PROTO(unsigned int filter, nodemask_t *nodemask), |
| 70 | TP_ARGS(filter, nodemask)); |
Liujie Xie | 2414944 | 2021-03-11 20:40:06 +0800 | [diff] [blame] | 71 | struct slabinfo; |
Yang Yang | 1b6f2f6 | 2021-05-13 19:28:11 +0800 | [diff] [blame] | 72 | struct dirty_throttle_control; |
| 73 | DECLARE_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 Gupta | 72488b3 | 2021-04-22 19:33:23 +0530 | [diff] [blame] | 79 | DECLARE_HOOK(android_vh_oom_check_panic, |
| 80 | TP_PROTO(struct oom_control *oc, int *ret), |
| 81 | TP_ARGS(oc, ret)); |
Liujie Xie | 8bc6337 | 2021-05-11 19:05:32 +0800 | [diff] [blame] | 82 | DECLARE_HOOK(android_vh_save_vmalloc_stack, |
| 83 | TP_PROTO(unsigned long flags, struct vm_struct *vm), |
| 84 | TP_ARGS(flags, vm)); |
| 85 | DECLARE_HOOK(android_vh_show_stack_hash, |
| 86 | TP_PROTO(struct seq_file *m, struct vm_struct *v), |
| 87 | TP_ARGS(m, v)); |
| 88 | DECLARE_HOOK(android_vh_save_track_hash, |
Liujie Xie | 7d216e2 | 2021-06-24 10:10:14 +0800 | [diff] [blame] | 89 | TP_PROTO(bool alloc, unsigned long p), |
| 90 | TP_ARGS(alloc, p)); |
Liangliang Li | 444a0b7 | 2021-06-21 20:32:49 +0800 | [diff] [blame] | 91 | struct mem_cgroup; |
| 92 | DECLARE_HOOK(android_vh_vmpressure, |
| 93 | TP_PROTO(struct mem_cgroup *memcg, bool *bypass), |
| 94 | TP_ARGS(memcg, bypass)); |
Liujie Xie | 1cdcf76 | 2021-07-03 12:09:04 +0800 | [diff] [blame] | 95 | DECLARE_HOOK(android_vh_mem_cgroup_alloc, |
| 96 | TP_PROTO(struct mem_cgroup *memcg), |
| 97 | TP_ARGS(memcg)); |
| 98 | DECLARE_HOOK(android_vh_mem_cgroup_free, |
| 99 | TP_PROTO(struct mem_cgroup *memcg), |
| 100 | TP_ARGS(memcg)); |
| 101 | DECLARE_HOOK(android_vh_mem_cgroup_id_remove, |
| 102 | TP_PROTO(struct mem_cgroup *memcg), |
| 103 | TP_ARGS(memcg)); |
| 104 | struct cgroup_subsys_state; |
| 105 | DECLARE_HOOK(android_vh_mem_cgroup_css_online, |
| 106 | TP_PROTO(struct cgroup_subsys_state *css, struct mem_cgroup *memcg), |
| 107 | TP_ARGS(css, memcg)); |
| 108 | DECLARE_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 Xie | 94fbab9 | 2021-08-25 02:26:18 +0800 | [diff] [blame] | 111 | DECLARE_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 Wang | 878e0ca | 2021-09-06 16:50:35 +0800 | [diff] [blame] | 114 | DECLARE_HOOK(android_vh_mmap_region, |
| 115 | TP_PROTO(struct vm_area_struct *vma, unsigned long addr), |
| 116 | TP_ARGS(vma, addr)); |
Jiewen Wang | 955f917 | 2021-09-06 16:55:03 +0800 | [diff] [blame] | 117 | DECLARE_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 Goldsworthy | 84fc3ab | 2021-12-09 14:47:35 -0800 | [diff] [blame] | 120 | struct device; |
| 121 | DECLARE_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 Kjos | 10fc8b2 | 2021-01-26 13:57:52 -0800 | [diff] [blame] | 124 | /* macro versions of hooks are no longer required */ |
Chris Goldsworthy | 62e32cf | 2020-11-09 22:26:47 -0800 | [diff] [blame] | 125 | |
| 126 | #endif /* _TRACE_HOOK_MM_H */ |
| 127 | |
| 128 | /* This part must be outside protection */ |
| 129 | #include <trace/define_trace.h> |