Skip to contentSkip to conversation

b78b0b6582: kselftests.damon.sysfs_memcg_path_leak.sh.fail

tip:locking/core Applied kernel test robot 5 participants 6 messages Aug 7 – Aug 8

Subsystems (3)
lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw

Hello,

kernel test robot noticed "kselftests.damon.sysfs_memcg_path_leak.sh.fail" on:

commit: b78b0b65825275f58336a43611a700de174be8c3 ("futex: Use runtime constants for __futex_hash() hot path")
https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git locking/core

in testcase: kselftests
version: kselftests-x86_64-f5098b6bae76-1_20260727 with following parameters:

group: damon

config: x86_64-rhel-9.4-kselftests
compiler: gcc-14
test machine: 16 threads Intel(R) Core(TM) i7-13620H (Raptor Lake) with 32G memory

(please refer to attached dmesg/kmsg for entire log/backtrace)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-lkp/[email protected]

# timeout set to 300
# selftests: damon: sysfs_memcg_path_leak.sh
# unreferenced object 0xffff8881029e0ab8 (size 8):
#   comm "swapper/0", pid 1, jiffies 4294668108
#   hex dump (first 8 bytes):
#     00 00 d0 02 81 88 ff ff                          ........
#   backtrace (crc 6c1bc6d6):
#     __kmalloc_noprof+0x56b/0x830
#     futex_init+0x108/0x3c0
#     do_one_initcall+0xc3/0x4b0
#     do_initcalls+0x215/0x240
#     kernel_init_freeable+0x4a1/0x530
#     kernel_init+0x18/0x180
#     ret_from_fork+0x547/0x870
#     ret_from_fork_asm+0x1a/0x30
not ok 13 selftests: damon: sysfs_memcg_path_leak.sh # exit=1

The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20260807/[email protected]

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#1 lore raw
Quoted 32 lines · kernel test robot

Hello,

kernel test robot noticed "kselftests.damon.sysfs_memcg_path_leak.sh.fail" on:

commit: b78b0b65825275f58336a43611a700de174be8c3 ("futex: Use runtime constants for __futex_hash() hot path")
https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git locking/core

in testcase: kselftests
version: kselftests-x86_64-f5098b6bae76-1_20260727 with following parameters:

group: damon

config: x86_64-rhel-9.4-kselftests
compiler: gcc-14
test machine: 16 threads Intel(R) Core(TM) i7-13620H (Raptor Lake) with 32G memory

(please refer to attached dmesg/kmsg for entire log/backtrace)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-lkp/[email protected]

Quoted 16 lines
# timeout set to 300
# selftests: damon: sysfs_memcg_path_leak.sh
# unreferenced object 0xffff8881029e0ab8 (size 8):
#   comm "swapper/0", pid 1, jiffies 4294668108
#   hex dump (first 8 bytes):
#     00 00 d0 02 81 88 ff ff                          ........
#   backtrace (crc 6c1bc6d6):
#     __kmalloc_noprof+0x56b/0x830
#     futex_init+0x108/0x3c0
#     do_one_initcall+0xc3/0x4b0
#     do_initcalls+0x215/0x240
#     kernel_init_freeable+0x4a1/0x530
#     kernel_init+0x18/0x180
#     ret_from_fork+0x547/0x870
#     ret_from_fork_asm+0x1a/0x30
not ok 13 selftests: damon: sysfs_memcg_path_leak.sh # exit=1

I have no idea what DAMON does or what this selftest is on about. SJ?

maintainer
#2 lore raw

Hello Peter,

Thank you for sharing this.

Quoted 50 lines · On Fri, 7 Aug 2026 11:01:39 +0200 Peter Zijlstra <[email protected]> wrote:
Quoted 32 lines · kernel test robot

Hello,

kernel test robot noticed "kselftests.damon.sysfs_memcg_path_leak.sh.fail" on:

commit: b78b0b65825275f58336a43611a700de174be8c3 ("futex: Use runtime constants for __futex_hash() hot path")
https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git locking/core

in testcase: kselftests
version: kselftests-x86_64-f5098b6bae76-1_20260727 with following parameters:

group: damon

config: x86_64-rhel-9.4-kselftests
compiler: gcc-14
test machine: 16 threads Intel(R) Core(TM) i7-13620H (Raptor Lake) with 32G memory

(please refer to attached dmesg/kmsg for entire log/backtrace)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-lkp/[email protected]

Quoted 16 lines
# timeout set to 300
# selftests: damon: sysfs_memcg_path_leak.sh
# unreferenced object 0xffff8881029e0ab8 (size 8):
#   comm "swapper/0", pid 1, jiffies 4294668108
#   hex dump (first 8 bytes):
#     00 00 d0 02 81 88 ff ff                          ........
#   backtrace (crc 6c1bc6d6):
#     __kmalloc_noprof+0x56b/0x830
#     futex_init+0x108/0x3c0
#     do_one_initcall+0xc3/0x4b0
#     do_initcalls+0x215/0x240
#     kernel_init_freeable+0x4a1/0x530
#     kernel_init+0x18/0x180
#     ret_from_fork+0x547/0x870
#     ret_from_fork_asm+0x1a/0x30
not ok 13 selftests: damon: sysfs_memcg_path_leak.sh # exit=1
Quoted 1 line

I have no idea what DAMON does or what this selftest is on about. SJ?

The test does a simple DAMON operation and runs kmemleak to see if it caused a leak. It doesn't filter out leaks caused by something other than the DAMON operation, though. So the test can fail even if there is a leak outside of DAMON. This failure is the case. I confirmed manual kmemleak run without any DAMON operation reports the leak on the kernel that was built with the reported commit [1] like below.

    # echo scan > /sys/kernel/debug/kmemleak
    # cat /sys/kernel/debug/kmemleak
    unreferenced object 0xffff888140f848d0 (size 16):
      comm "swapper/0", pid 1, jiffies 4294892369
      hex dump (first 16 bytes):
        00 00 fd 40 81 88 ff ff 00 00 25 80 81 88 ff ff  ...@......%.....
      backtrace (crc 1f413cd3):
        __kmalloc_noprof+0x446/0x590
        futex_init+0x99/0x230
        do_one_initcall+0x5c/0x300
        kernel_init_freeable+0x23f/0x2c0
        kernel_init+0x1a/0x130
        ret_from_fork+0x230/0x2f0
        ret_from_fork_asm+0x1a/0x30

So, the commit is not breaking DAMON. But apparently it is leaking something.

Sorry for making the confusing noise. I will update the test to not fail for non-DAMON leak.

FYI, the 'decode_stacktrace.sh' output is like below:

    unreferenced object 0xffff888140f848d0 (size 16):
    comm "swapper/0", pid 1, jiffies 4294892369
    hex dump (first 16 bytes):
    00 00 fd 40 81 88 ff ff 00 00 25 80 81 88 ff ff  ...@......%.....
    backtrace (crc 1f413cd3):
    __kmalloc_noprof (include/linux/kmemleak.h:44 mm/slub.c:4625 mm/slub.c:4945 mm/slub.c:5361 mm/slub.c:5387)
    futex_init (include/linux/slab.h:973 include/linux/slab.h:1189 kernel/futex/core.c:2024)
    do_one_initcall (init/main.c:1347)
    kernel_init_freeable (init/main.c:1409 (discriminator 1) init/main.c:1425 (discriminator 1) init/main.c:1445 (discriminator 1) init/main.c:1658 (discriminator 1))
    kernel_init (init/main.c:1548)
    ret_from_fork (arch/x86/kernel/process.c:158)
    ret_from_fork_asm (arch/x86/entry/entry_64.S:245)

[1] b78b0b658252 ("futex: Use runtime constants for __futex_hash() hot path")

Thanks,
SJ

#3 lore raw
Quoted 5 lines · SJ Park
Quoted 4 lines
Quoted 4 lines

kernel test robot noticed "kselftests.damon.sysfs_memcg_path_leak.sh.fail" on:

commit: b78b0b65825275f58336a43611a700de174be8c3 ("futex: Use runtime constants for __futex_hash() hot path")
https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git locking/core

Quoted 8 lines

The test does a simple DAMON operation and runs kmemleak to see if it caused a leak. It doesn't filter out leaks caused by something other than the DAMON operation, though. So the test can fail even if there is a leak outside of DAMON. This failure is the case. I confirmed manual kmemleak run without any DAMON operation reports the leak on the kernel that was built with the reported commit [1] like below.

So, the commit is not breaking DAMON. But apparently it is leaking something.

Well, its doing a __init allocation and never freeing it because well, futexes cannot be unloaded or anything.

Catalin, this seems rather daft, but what do I know. Is the below the right way to tell it to STFU?

---

kernel/futex/core.c +2 -0
index ad917ff83854..afdbaf754fb7 100644
@@ -45,6 +45,7 @@
 #include <linux/rseq.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
+#include <linux/kmemleak.h>
 
 #include <vdso/futex.h>
 
@@ -2058,6 +2059,7 @@ static int __init futex_init(void)
 	order = get_order(size);
 
 	__futex_queues = kcalloc(nr_node_ids, sizeof(*__futex_queues), GFP_KERNEL);
+	kmemleak_not_leak(__futex_queues);
 
 	runtime_const_init(shift, __futex_shift);
 	runtime_const_init(mask,  __futex_mask);
#4 lore raw
Quoted 35 lines · Peter Zijlstra
Quoted 5 lines · SJ Park
Quoted 4 lines
Quoted 4 lines

kernel test robot noticed "kselftests.damon.sysfs_memcg_path_leak.sh.fail" on:

commit: b78b0b65825275f58336a43611a700de174be8c3 ("futex: Use runtime constants for __futex_hash() hot path")
https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git locking/core

Quoted 8 lines

The test does a simple DAMON operation and runs kmemleak to see if it caused a leak. It doesn't filter out leaks caused by something other than the DAMON operation, though. So the test can fail even if there is a leak outside of DAMON. This failure is the case. I confirmed manual kmemleak run without any DAMON operation reports the leak on the kernel that was built with the reported commit [1] like below.

So, the commit is not breaking DAMON. But apparently it is leaking something.

Well, its doing a __init allocation and never freeing it because well, futexes cannot be unloaded or anything.

Catalin, this seems rather daft, but what do I know. Is the below the right way to tell it to STFU?

---

kernel/futex/core.c +1 -0
index ad917ff83854..afdbaf754fb7 100644
@@ -45,6 +45,7 @@
 #include <linux/rseq.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
+#include <linux/kmemleak.h>
 
 #include <vdso/futex.h>
 

kernel/futex/core.c static int __init futex_init(void) · line 2065

Quoted 7 lines
kernel/futex/core.c +1 -0
@@ -2058,6 +2059,7 @@ static int __init futex_init(void)
 	order = get_order(size);
 
 	__futex_queues = kcalloc(nr_node_ids, sizeof(*__futex_queues), GFP_KERNEL);
+	kmemleak_not_leak(__futex_queues);
 
 	runtime_const_init(shift, __futex_shift);
 	runtime_const_init(mask,  __futex_mask);

This would do. Kmemleak is not that advanced to track the runtime_const_init() pointers.

Signature · 1 line
Catalin
merge bot Applied
#5 lore raw

[tip: locking/core] futex: Tell kmemleak we're not leaking __futex_queues

In reply to Peter Zijlstra
The following commit has been merged into the locking/core branch of tip:

The following commit has been merged into the locking/core branch of tip:

Commit-ID:     fcb8ada1287227a1392930ee52d7b6c6cab0f0b2
Gitweb:        https://git.kernel.org/tip/fcb8ada1287227a1392930ee52d7b6c6cab0f0b2
Author:        Peter Zijlstra <[email protected]>
AuthorDate:    Fri, 07 Aug 2026 17:23:53 +02:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Sat, 08 Aug 2026 12:41:59 +02:00

futex: Tell kmemleak we're not leaking __futex_queues

Kmemleak doesn't know about runtime_const stuff and figures we're leaking __futex_queues. So add this little annotation to tell it all is well.

---
 kernel/futex/core.c | 2 ++
 1 file changed, 2 insertions(+)
kernel/futex/core.c +2 -0
index d3fcad4..45538ac 100644
@@ -45,6 +45,7 @@
 #include <linux/rseq.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
+#include <linux/kmemleak.h>
 
 #include <vdso/futex.h>
 
@@ -2028,6 +2029,7 @@ static int __init futex_init(void)
 	order = get_order(size);
 
 	__futex_queues = kcalloc(nr_node_ids, sizeof(*__futex_queues), GFP_KERNEL);
+	kmemleak_not_leak(__futex_queues);
 
 	runtime_const_init(shift, __futex_shift);
 	runtime_const_init(mask,  __futex_mask);