summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorAbhishek Bapat <abhishekbapat@google.com>2026-07-08 18:01:26 +0000
committerAndrew Morton <akpm@linux-foundation.org>2026-08-20 18:24:35 -0700
commit8cab95459c6df03fe1dcd617174aaaa3215fc0fe (patch)
tree4de15d94f1aab6f03f81258ccff7e5990dc681f2 /mm
parentc38218afe95d246cdb30f882c149225beec1dc8a (diff)
downloadlinux-next-8cab95459c6df03fe1dcd617174aaaa3215fc0fe.tar.gz
linux-next-8cab95459c6df03fe1dcd617174aaaa3215fc0fe.zip
alloc_tag: add accuracy based filtering to ioctl
Extend the allocinfo filtering mechanism to allow users to filter tags based on their accuracy. [abhishekbapat@google.com: move `inaccurate` filtering criteria from `struct allocinfo_tag` to `struct allocinfo_filter`] Link: https://lore.kernel.org/e4e49ec4a5960292aeeb9e196526c18dc95228a2.1785867739.git.abhishekbapat@google.com Link: https://lore.kernel.org/396a5e4bc3b2990223ab355f2cd3ceb6aa15499e.1783532853.git.abhishekbapat@google.com Signed-off-by: Abhishek Bapat <abhishekbapat@google.com> Acked-by: Hao Ge <hao.ge@linux.dev> Acked-by: Suren Baghdasaryan <surenb@google.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Kent Overstreet <kent.overstreet@linux.dev> Cc: Sourav Panda <souravpanda@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/alloc_tag.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/mm/alloc_tag.c b/mm/alloc_tag.c
index 04b640d74bcc..b33410310477 100644
--- a/mm/alloc_tag.c
+++ b/mm/alloc_tag.c
@@ -262,6 +262,8 @@ static bool matches_filter(struct codetag *ct, struct allocinfo_filter *filter,
struct alloc_tag_counters *counters,
bool *fetched_counters)
{
+ bool inaccurate;
+
if (!filter || !filter->mask)
return true;
@@ -287,6 +289,12 @@ static bool matches_filter(struct codetag *ct, struct allocinfo_filter *filter,
ct->lineno != filter->fields.lineno)
return false;
+ if (filter->mask & ALLOCINFO_FILTER_MASK_INACCURATE) {
+ inaccurate = !!(ct->flags & CODETAG_FLAG_INACCURATE);
+ if (inaccurate != !!(filter->inaccurate))
+ return false;
+ }
+
if (filter->mask & (ALLOCINFO_FILTER_MASK_MIN_SIZE | ALLOCINFO_FILTER_MASK_MAX_SIZE)) {
if (!*fetched_counters) {
*counters = allocinfo_prefetch_counters(ct);