History

alloc_tag: add ioctl filters to /proc/allocinfo

Extend the capability of the IOCTL mechanism to filter allocations based on tag's module name, function name, file name and line number.

Abhishek Bapat committed 4 months ago

Commit 5732a4e1 parent 1d581ab2 files · +89 −5Browse files

Showing the changes to include/uapi/linux (1 of 2 files). Show all

Unified · Split

include/uapi/linux/alloc_tag.h+25−1
@@ -45,8 +45,32 @@ struct allocinfo_tag_data { · 44 unmodified lines
4545 struct allocinfo_counter counter;
4646 };
4747
48+enum {
49+ ALLOCINFO_FILTER_MODNAME,
50+ ALLOCINFO_FILTER_FUNCTION,
51+ ALLOCINFO_FILTER_FILENAME,
52+ ALLOCINFO_FILTER_LINENO,
53+ __ALLOCINFO_FILTER_LAST = ALLOCINFO_FILTER_LINENO
54+};
55+
56+#define ALLOCINFO_FILTER_MASK_MODNAME (1 << ALLOCINFO_FILTER_MODNAME)
57+#define ALLOCINFO_FILTER_MASK_FUNCTION (1 << ALLOCINFO_FILTER_FUNCTION)
58+#define ALLOCINFO_FILTER_MASK_FILENAME (1 << ALLOCINFO_FILTER_FILENAME)
59+#define ALLOCINFO_FILTER_MASK_LINENO (1 << ALLOCINFO_FILTER_LINENO)
60+
61+#define ALLOCINFO_FILTER_MASKS \
62+ ((1 << (__ALLOCINFO_FILTER_LAST + 1)) - 1)
63+
64+struct allocinfo_filter {
65+ __u64 mask; /* bitmask of the filter fields used */
66+ struct allocinfo_tag fields;
67+};
68+
4869 struct allocinfo_get_at {
49− __u64 pos; /* input */
70+ /* inputs */
71+ __u64 pos;
72+ struct allocinfo_filter filter;
73+ /* output */
5074 struct allocinfo_tag_data data;
5175 };
5276