Repository navigation
Description
Describe the bug
After upgrading from 5.10.46 to 5.10.48, I had issues with oom-killer killing Kodi in about 20mins of starting to watch a video. The system then became unstable, with other processes being randomly killed, and a system reboot was required.
To reproduce
Play video on Kodi. Monitor kmalloc-128 increasing via slabtop -s c
Expected behaviour
Kodi not be oom-killed
Actual behaviour
Kodi oom-killed, along with other processes. System unstable requiring reboot.
System
Copy and paste the results of the raspinfo command in to this section. Alternatively, copy and paste a pastebin link, or add answers to the following questions:
Model: Raspberry Pi 4
OS: Arch Linux ARM
Firmware: Jul 21 2021 16:21:46 version 6a796bb0062a6c75191c57cba1c13f9300076d02
Kernel: 5.10.52 (issue seen since updating to 5.10.48; but may have also been present on slightly earlier version)
Logs
$ sudo slabtop -s c
Active / Total Objects (% used) : 266001 / 289256 (92.0%)
Active / Total Slabs (% used) : 13992 / 13992 (100.0%)
Active / Total Caches (% used) : 137 / 265 (51.7%)
Active / Total Size (% used) : 93490.38K / 103413.99K (90.4%)
Minimum / Average / Maximum Object : 0.17K / 0.36K / 16.00K
OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME
83628 83586 99% 0.38K 3987 21 31896K kmalloc-128
15316 14367 93% 0.55K 547 28 8752K inode_cache
30720 30691 99% 0.27K 1024 30 8192K ext4_groupinfo_4k
31424 28348 90% 0.25K 1964 16 7856K kmalloc-64
24975 17937 71% 0.29K 925 27 7400K dentry
26192 26153 99% 0.24K 1637 16 6548K kernfs_node_cache
11169 11152 99% 0.45K 657 17 5256K radix_tree_node
3728 1177 31% 0.95K 233 16 3728K ext4_inode_cache
11222 10974 97% 0.26K 362 31 2896K vm_area_struct
1168 1127 96% 2.00K 73 16 2336K kmalloc-1k
1872 1779 95% 1.00K 117 16 1872K kmalloc-512
392 378 96% 3.94K 49 8 1568K task_struct
Noted high number of drm_atomic_helper_setup_commit:
$ sudo sort -rn /sys/kernel/slab/kmalloc-128/alloc_calls | head
80462 drm_atomic_helper_setup_commit+0x21c/0x7bc [drm_kms_helper] age=3/84268/167031 pid=276-602 cpus=0-3
153 drm_property_create+0xa0/0x190 [drm] age=167039/167040/167044 pid=276 cpus=1
93 snd_info_create_entry+0x28/0xe0 [snd] age=167039/167148/167184 pid=244-276 cpus=1
47 drm_mode_duplicate+0x20/0x4c [drm] age=167032/167032/167032 pid=276 cpus=1
28 drm_universal_plane_init+0x118/0x604 [drm] age=167039/167039/167039 pid=276 cpus=1
17 __ipv6_dev_mc_inc+0x154/0x3c4 [ipv6] age=165848/166512/167270 pid=1-594 cpus=0-3
14 v3d_fence_create+0x28/0x9c [v3d] age=3768/64040/165436 pid=322-323 cpus=0-2
11 devm_snd_soc_register_component+0x2c/0x80 [snd_soc_core] age=167040/167054/167107 pid=261-276 cpus=1-2
10 snd_ctl_new+0x34/0x8c [snd] age=167039/167068/167182 pid=244-276 cpus=1
9 __drmm_add_action_or_reset+0x14/0x30 [drm] age=167038/167047/167078 pid=271-276 cpus=1
I downgraded to 5.10.46 and this has resolved the issue:
$ sudo grep drm_atomic_helper_setup_commit /sys/kernel/slab/kmalloc-128/alloc_calls
9 drm_atomic_helper_setup_commit+0x214/0x790 [drm_kms_helper] age=1/236240/305496 pid=113-590 cpus=0-3
1 drm_atomic_helper_setup_commit+0x538/0x790 [drm_kms_helper] age=1 pid=590 cpus=1
1 drm_atomic_helper_setup_commit+0x6f4/0x790 [drm_kms_helper] age=304206 pid=590 cpus=0
Additional context
Also report on anholt#156
Forum post: https://www.raspberrypi.org/forums/viewtopic.php?f=53&t=316394
Activity
kwirk commentedon Jul 25, 2021
I've also built latest rpi-5.10.y (7aa66c0) including #4470 applied as a patch, which results in same behaviour: increasing number of allocation calls from
drm_atomic_helper_setup_commitin kmalloc-128.popcornmix commentedon Jul 25, 2021
I would be suspecting one of these : #4441
Can you try building at
3282562~(i.e. one commit before that PR) and at3d7507e(i.e. end of PR) and check if each is okay?kwirk commentedon Jul 25, 2021
So I'm currently running
3282562~(64f5ffe) without issue (was packaged as 5.10.42-2 on Arch Linux ARM).Currently building 3d7507e…
kwirk commentedon Jul 25, 2021
Looks like 3d7507e has the issue.
I saw on #4441 f14d057 introduced a
atomic_commit_setupfunction and 2f3e2d8 switched to usingdrm_atomic_helper_commit, anddrm_atomic_helper_setup_commitis where I'm seeing constant allocations coming from…popcornmix commentedon Jul 25, 2021
Sounds likely. Are you able to confirm memory leak starts with that commit?
kwirk commentedon Jul 25, 2021
So the issue was introduced with 135abe8. I also applied e621e4e as a patch on top of this, as noted this commit related to same section of code (I had tested e621e4e on latest rpi-5.10.y (7aa66c0) previously but wanted to double check), but the issue persists.
popcornmix commentedon Jul 26, 2021
@mripard any thoughts on a memory leak introduced with "drm/vc4: kms: Wait on previous FIFO users before a commit"?
mripard commentedon Jul 26, 2021
I think that we have the drm_crtc_commit ref counting wrong somehow and thus never free it for each commit.
However, I started to run an application that does a commit each frame, and while I can definitely see the kmalloc-128 slab increase over time, I'm not getting the drm_atomic_helper_setup_commit call, at all, which is fairly weird.
kwirk commentedon Jul 26, 2021
Built and tested latest rpi-5.10.y (9a22b00), now #4478 is merged. Working fine so far with no sign on kmalloc-128 increasing 👍
Marcool04 commentedon Aug 3, 2021
I have been experiencing out of memory issues on a raspberry pi 4, 8Gb RAM, armv7h system, using kernel 5.10.52. In my case, the reversions in pull request #4478 have not solved the issue. Archlinuxarm linux-raspberrypi4 package at version 5.10.52-5 is built from commit 6495fa3, and therefore includes the reversions made in #4478 that are supposed to have solved this issue according to above comment, but still has the oom behaviour on my system.
Change occurred somewhere between 2697f74 (which I'm running now with no oom issues) and 86729e7 (when they started, and were not fixed by #4478). At least one other user has reported a similar situation on the archlinuxarm forum: https://archlinuxarm.org/forum/viewtopic.php?f=60&t=15460&p=67115#p67115
It would seem that on aarch64 systems the reversions did indeed fix the problem though.
kwirk commentedon Aug 3, 2021
@Marcool04: It would be interesting to see if you have the memory leak in the same place, as I don't believe the code which caused this memory leak is reachable (not 100% confident however…).
Could you add
slub_debug=Uto your boot parameters (in/boot/cmdline.txt) and look atslabtop -s -candallloc_callssimilar to my original comment?kwirk commentedon Aug 3, 2021
I've been using 5.10.52-4 without issue (86729e7), and just upgraded to 5.10.52-6 (4e5d621), and again no issues.
Marcool04 commentedon Aug 3, 2021
Indeed @kwirk there would appear to be some error on my part. Either this has been resolved between 5.10.52-5 and 5.10.52-6 (but no commit in between seems to indicate it should have), or I have an issue somewhere else, as I am now running the latest archlinuxarm kernel just fine…
This time, the difference is I did not upgrade my AUR packages (which I usually do at the same time as I upgrade with pacman)…
Maybe one of
electron12-bin-12.0.15-1 highway-0.14.0-1 moarvm-2021.07-1 nqp-2021.07-1 pbget-2021.7-1 pm2ml-2021.8-1 python-mautrix-0.9.10-1 python-tifffile-2021.7.30-1 python3-xcpf-2021-1 rakudo-2021.07-1 rompr-1.59.1-1 mx-puppet-discord-git-r248.c17384a-3is causing a memory leak… All of those packages are used by systemd services that start on boot so they are candidates. I'll have to upgrade them one by one and see I guess!Thanks for taking the time to help.
Regards,
Mark.
telsch commentedon Aug 4, 2021
It looks like 5.10.52-6 don't invoked oom-killer for docker anymore.
core/linux-rpi to 6.12.38-1
dinobagio commentedon Jul 23, 2025
Hi @kwirk,
I've been experiencing the same things on my arch rpi kodi for a few days,
Currently on 6.12.37.
cf. archlinuxarm/PKGBUILDs@525de88#commitcomment-162673111
Any chance 6.12.38 could fix this ?
Did you have some similar reports ?
Thanks for your help
popcornmix commentedon Jul 25, 2025
You are commenting on a four year old, closed issue, so yours is almost certainly not related.
I'm not aware of any similar reports, but feel free to create a new issue.
Describe exactly how to reproduce.
But be aware we may need to be able to reproduce on RPiOS to investigate.
dinobagio commentedon Jul 28, 2025
OK @popcornmix
just did.
#6976