Move the `inaccurate` filtering criteria from `struct allocinfo_tag` to `struct allocinfo_filter`. Also fix a typo in the selftest added to validate the introduced feature. This is a fixup patch to resolve a pending comment left by sashiko on the patch series starting with Commit bc3da70ba4d9 ("alloc_tag: add ioctl to /proc/allocinfo"). Note, sashiko also left a valid comment on the selftest about the sscanf in the test skipping loaded modules, however, it was a deliberate design choice. The modules were kept out of the test baseline on purpose as dunamic module loading/unloading can trigger content_id mismatches (which can cause flakiness). Since the IOCTL logic itself function regardless of whether the codetag is in vmlinux or a loadable module, stocking to stable built-in targets keeps the tests robust. Fixes: b011dfc9f8d6 ("alloc_tag: add accuracy based filtering to ioctl") Fixes: 359316c50445 ("kselftest: alloc_tag: add kselftest for ioctl interface") Closes: https://sashiko.dev/#/patchset/cover.1783532853.git.abhishekbapat@google.com Signed-off-by: Abhishek Bapat --- include/uapi/linux/alloc_tag.h | 4 ++-- mm/alloc_tag.c | 2 +- tools/testing/selftests/alloc_tag/allocinfo_ioctl_test.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/uapi/linux/alloc_tag.h b/include/uapi/linux/alloc_tag.h index 270f693b1822..e3ad94444864 100644 --- a/include/uapi/linux/alloc_tag.h +++ b/include/uapi/linux/alloc_tag.h @@ -31,8 +31,6 @@ struct allocinfo_tag { char function[ALLOCINFO_STR_SIZE]; char filename[ALLOCINFO_STR_SIZE]; __u64 lineno; - /* filter criteria only; see allocinfo_counter.accurate for actual accuracy */ - __u64 inaccurate; }; /* The alignment ensures 32-bit compatible interfaces are not broken */ @@ -74,6 +72,8 @@ struct allocinfo_filter { struct allocinfo_tag fields; __u64 min_size; __u64 max_size; + /* filter criteria only; see allocinfo_counter.accurate for actual accuracy */ + __u64 inaccurate; }; struct allocinfo_get_at { diff --git a/mm/alloc_tag.c b/mm/alloc_tag.c index 52aece27b00e..84c5c3783ca4 100644 --- a/mm/alloc_tag.c +++ b/mm/alloc_tag.c @@ -291,7 +291,7 @@ static bool matches_filter(struct codetag *ct, struct allocinfo_filter *filter, if (filter->mask & ALLOCINFO_FILTER_MASK_INACCURATE) { inaccurate = !!(ct->flags & CODETAG_FLAG_INACCURATE); - if (inaccurate != !!(filter->fields.inaccurate)) + if (inaccurate != !!(filter->inaccurate)) return false; } diff --git a/tools/testing/selftests/alloc_tag/allocinfo_ioctl_test.c b/tools/testing/selftests/alloc_tag/allocinfo_ioctl_test.c index 7d94abb785a1..74fd64b2370c 100644 --- a/tools/testing/selftests/alloc_tag/allocinfo_ioctl_test.c +++ b/tools/testing/selftests/alloc_tag/allocinfo_ioctl_test.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* kselftest for allocinfo ioctl - * allocinfo ioctl retrives allocinfo data through ioctl + * allocinfo ioctl retrieves allocinfo data through ioctl * Copyright (C) 2026 Google, Inc. */ base-commit: 486855239e38a91d3eae26618ccb7845c1764625 -- 2.55.0.508.g3f0d502094-goog