-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revert "mm: alloc_contig: re-allow CMA to compact FS pages" #2647
Revert "mm: alloc_contig: re-allow CMA to compact FS pages" #2647
Conversation
The upstream commit caused poor video playback performance on a busy system for many users. See: raspberrypi#2503 This reverts commit 424f6c4. Signed-off-by: popcornmix <popcornmix@gmail.com>
Ping @pelwell @6by9 @lategoodbye for comments. |
I'm not going to drill down to understand why the original commit degraded performance, although I know from past experience that CMA compactions can be slow so having more could slow things down. If reverting causes a noticeable improvement in some use cases then I'm happy to merge, at least until a negative side-effect is discovered. |
Thanks for pinging me. Unfortunately memory management is beyond my knowledge. I think reverting such fundamental things is a temporary solution to make the user happy again. But we still need to identify and fix the root cause in the relevant drivers. Since this is CMA related, i think we can exclude sdhost and dwc_otg. |
Likewise not an area I know lots about. I guess this leaves us in a position that could result in a more fragmented CMA heap. That'll affect the vc4 driver, and potentially mem_allocs when I get that merged. I know Kodi can use vc4-kms-v3d, but I didn't think it did by default. Video decode doesn't currently either, so it seems strange that there is anything triggering a CMA compaction. I'm not dismissing it, but it does raise questions that really need to be answered. Can we reproduce the problem here? |
I've not reproduced it. It needs more than just kodi running to see the problem. Hard to say if an actual cma allocation is getting blocked, or it's just just busy cpu/sdram than blocks things. As a guess I'd say the VCHIQ messages are getting blocked for approaching 100ms (typical amount of queued audio on VPU), hence the audio glitch. But I don't believe VCHIQ messages rely on CMA allocations. |
The CMA compaction problem didn't exist on 4.9 kernel, so I'm assuming it wasn't done there. So probably we are no worse off than on current 4.9 kernel. |
Sorry, I'd misremembered the thread as it being external sound cards rather than HDMI audio.
Very true. |
I knew I'd seen CMA debugging - it's under CONFIG_CMA_DEBUGFS which isn't enabled by the standard configs. There's also CONFIG_CMA_DEBUG which logs all CMA operations (probably overkill for most situations). |
|
I'm happy enough with the revert then as it has been shown to solve the problem. CMA is used for all (almost?) DMA allocations.
Enabling CONFIG_CMA_DEBUGFS by default wouldn't be a bad thing, and then /sys/kernel/debug/cma/cma-reserved/bitmap gives you an indication of how used the CMA heap is. I'll investigate whether we can easily add dumping info on all the allocations currently made via CMA. It'll only be a rough idea as all allocations are done in units of pages by the time it hits CMA. |
Nope, not possible. CMA itself is just keeping a list of used pages in a bitmask, not a list of who has allocated anything, nor the size of those allocations. If other subsystems screw up, then they could ask to allocate 5 pages, but then release 6 pages. |
Improvement is confirmed in Milhouse LibreELEC nightly. No complaints. |
…rypi/linux#2647 Signed-off-by: Sam Nazarko <email@samnazarko.co.uk>
kernel: bcm2835: interpolate audio delay See: #1026 kernel: dtoverlays: Add support for ADV7280-M and ADV7281-M chips See: raspberrypi/linux#2656 kernel: First batch of fixes for V4L2 camera driver See: raspberrypi/linux#2609 kernel: Revert mm: alloc_contig: re-allow CMA to compact FS pages See: raspberrypi/linux#2647 firmware: rawcam: Fix double buffer return issue firmware: rawcam: Code cleanup firmware: host_apps: Fixup partially merged commit from userland See: #1027 firmware: mmal: Add KEEP_PORT_FORMATS flag to mmal connection See: raspberrypi/userland#483 firmware: RaspiStill: Apply gpsd info as EXIF tags See: raspberrypi/userland#286
kernel: bcm2835: interpolate audio delay See: raspberrypi/firmware#1026 kernel: dtoverlays: Add support for ADV7280-M and ADV7281-M chips See: raspberrypi/linux#2656 kernel: First batch of fixes for V4L2 camera driver See: raspberrypi/linux#2609 kernel: Revert mm: alloc_contig: re-allow CMA to compact FS pages See: raspberrypi/linux#2647 firmware: rawcam: Fix double buffer return issue firmware: rawcam: Code cleanup firmware: host_apps: Fixup partially merged commit from userland See: raspberrypi/firmware#1027 firmware: mmal: Add KEEP_PORT_FORMATS flag to mmal connection See: raspberrypi/userland#483 firmware: RaspiStill: Apply gpsd info as EXIF tags See: raspberrypi/userland#286
The upstream commit caused poor video playback performance
on a busy system for many users.
See: #2503
This reverts commit 424f6c4.
Signed-off-by: popcornmix popcornmix@gmail.com