summaryrefslogtreecommitdiff
path: root/include/trace/events/vmalloc.h
blob: ad4e02191f356e1678a96bd5ceaab7c8cec60d4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM vmalloc

#if !defined(_TRACE_VMALLOC_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_VMALLOC_H

#include <linux/tracepoint.h>

/**
 * alloc_vmap_area - called when a new vmap allocation occurs
 * @addr:	an allocated address
 * @size:	a requested size
 * @align:	a requested alignment
 * @vstart:	a requested start range
 * @vend:	a requested end range
 * @failed:	an allocation failed or not
 *
 * This event is used for a debug purpose, it can give an extra
 * information for a developer about how often it occurs and which
 * parameters are passed for further validation.
 */
TRACE_EVENT(alloc_vmap_area,

	TP_PROTO(unsigned long addr, unsigned long size, unsigned long align,
		unsigned long vstart, unsigned long vend, int failed),

	TP_ARGS(addr, size, align, vstart, vend, failed),

	TP_STRUCT__entry(
		__field(unsigned long, addr)
		__field(unsigned long, size)
		__field(unsigned long, align)
		__field(unsigned long, vstart)
		__field(unsigned long, vend)
		__field(int, failed)
	),

	TP_fast_assign(
		__entry->addr = addr;
		__entry->size = size;
		__entry->align = align;
		__entry->vstart = vstart;
		__entry->vend = vend;
		__entry->failed = failed;
	),

	TP_printk("va_start: %lu size=%lu align=%lu vstart=0x%lx vend=0x%lx failed=%d",
		__entry->addr, __entry->size, __entry->align,
		__entry->vstart, __entry->vend, __entry->failed)
);

/**
 * purge_vmap_area_lazy - called when vmap areas were lazily freed
 * @start:		purging start address
 * @end:		purging end address
 * @npurged:	numbed of purged vmap areas
 *
 * This event is used for a debug purpose. It gives some
 * indication about start:end range and how many objects
 * are released.
 */
TRACE_EVENT(purge_vmap_area_lazy,

	TP_PROTO(unsigned long start, unsigned long end,
		unsigned int npurged),

	TP_ARGS(start, end, npurged),

	TP_STRUCT__entry(
		__field(unsigned long, start)
		__field(unsigned long, end)
		__field(unsigned int, npurged)
	),

	TP_fast_assign(
		__entry->start = start;
		__entry->end = end;
		__entry->npurged = npurged;
	),

	TP_printk("start=0x%lx end=0x%lx num_purged=%u",
		__entry->start, __entry->end, __entry->npurged)
);

/**
 * free_vmap_area_noflush - called when a vmap area is freed
 * @va_start:		a start address of VA
 * @nr_lazy:		number of current lazy pages
 * @nr_lazy_max:	number of maximum lazy pages
 *
 * This event is used for a debug purpose. It gives some
 * indication about a VA that is released, number of current
 * outstanding areas and a maximum allowed threshold before
 * dropping all of them.
 */
TRACE_EVENT(free_vmap_area_noflush,

	TP_PROTO(unsigned long va_start, unsigned long nr_lazy,
		unsigned long nr_lazy_max),

	TP_ARGS(va_start, nr_lazy, nr_lazy_max),

	TP_STRUCT__entry(
		__field(unsigned long, va_start)
		__field(unsigned long, nr_lazy)
		__field(unsigned long, nr_lazy_max)
	),

	TP_fast_assign(
		__entry->va_start = va_start;
		__entry->nr_lazy = nr_lazy;
		__entry->nr_lazy_max = nr_lazy_max;
	),

	TP_printk("va_start=0x%lx nr_lazy=%lu nr_lazy_max=%lu",
		__entry->va_start, __entry->nr_lazy, __entry->nr_lazy_max)
);

#endif /*  _TRACE_VMALLOC_H */

/* This part must be outside protection */
#include <trace/define_trace.h>