02-08-2021, 06:17 PM
(This post was last modified: 02-08-2021, 06:20 PM by moonwalkers.)
I know that coherent_pool is a Linux kernel command line parameter, and it "sets the size of memory pool for coherent, atomic DMA allocations". I know it is specific to ARM ISA. I know it is set to 1M (1MiB) in bootloader config in Danielt's unofficial Debian installer script, and likely in most other Linux images/installers for PBP. I know in-kernel it defaults to 256KiB. I know (both from own experience and from some experienced Linux systems engineers) that various "performance tweaks" often times at best give marginal improvements or have a placebo effect, at worst can compromise system performance or stability or both. But at least for tweaks like vm.swappiness or the likes there are pretty clear consequences of changing their value either way. Even CMA (Contiguous Memory Allocator) has reasonably clear consequences of tweaking the value - too little and your device drivers for e.g. webcam may be unable to allocate enough RAM to work properly, too much is just pointless though shouldn't hurt your system (in practice it appears to be "eating" into memory usable by normal applications - e.g. when I experimented with very high CMA numbers my applications at some point started OOMing).
What I'm still puzzled by though through and through is coherent_pool - so far I have been unable to figure out what exact effect changing this value would have. It appears there is some interplay with CMA - e.g. if I set coherent_pool to 1M-8M and CMA at their default 64M things seem to work fine, if I drop CMA to 0 I easily get OOMs if coherent_pool is still set to 1M-8M, but system seems to work fine if I set coherent_pool or both to 0 (admittedly, haven't tried using webcam or any USB devices in that setup). So from that I conclude that coherent_pool actually needs CMA to work correctly, even if from https://lwn.net/Articles/479297/ it seems that CMA is a more recent development than coherent_pool. Some googling around shows that people run into some issues with certain drivers if coherent_pool is not set large enough (and especially if CMA is not enabled/large enough - one source had system complain about insufficiently big coherent_pool, and the issue was fixed by increasing CMA size instead), and some other sources claim issues if coherent_pool is set too large.
AFAIK there are some people working on kernel code around here, I am hoping that maybe some of them would know enough about kernel (as large of a knowledge area it is though) to provide some clarity on coherent_pool - what exactly is this setting for, how does it interact with CMA, why is it set by default to 256KiB if it (supposedly) frequently needs (does it?) to be tweaked to larger amounts, what is the effect of increasing or lowering its value too much?
What I'm still puzzled by though through and through is coherent_pool - so far I have been unable to figure out what exact effect changing this value would have. It appears there is some interplay with CMA - e.g. if I set coherent_pool to 1M-8M and CMA at their default 64M things seem to work fine, if I drop CMA to 0 I easily get OOMs if coherent_pool is still set to 1M-8M, but system seems to work fine if I set coherent_pool or both to 0 (admittedly, haven't tried using webcam or any USB devices in that setup). So from that I conclude that coherent_pool actually needs CMA to work correctly, even if from https://lwn.net/Articles/479297/ it seems that CMA is a more recent development than coherent_pool. Some googling around shows that people run into some issues with certain drivers if coherent_pool is not set large enough (and especially if CMA is not enabled/large enough - one source had system complain about insufficiently big coherent_pool, and the issue was fixed by increasing CMA size instead), and some other sources claim issues if coherent_pool is set too large.
AFAIK there are some people working on kernel code around here, I am hoping that maybe some of them would know enough about kernel (as large of a knowledge area it is though) to provide some clarity on coherent_pool - what exactly is this setting for, how does it interact with CMA, why is it set by default to 256KiB if it (supposedly) frequently needs (does it?) to be tweaked to larger amounts, what is the effect of increasing or lowering its value too much?
This message was created with 100% recycled electrons