snd_pcm_lib...locate_pages(9)
β¨ snd_pcm_lib_preallocate_pages β the NAME bit β¨
Okay so bestie, welcome to the Kernel API Manual π this is the page for snd_pcm_lib_preallocate_pages β it's literally pre-allocation for the given DMA type. That's the whole vibe. π
πΈ SYNOPSIS πΈ
void snd_pcm_lib_preallocate_pages (struct snd_pcm_substream *substream
, int type , struct device *data , size_t size , size_t max );
Yep, that's the whole signature, no cap. Copy it exactly, don't get cute with it. π
π¦ ARGUMENTS π¦
substreamβ the pcm substream instance π«Ά like, the actual thing you're preallocating for.typeβ the DMA type, written asSNDRV_DMA_TYPE_*(star and all, that's the pattern, don't @ me).dataβ DMA type dependent data. so it depends on the type, iykyk β¨sizeβ the requested pre-allocation size in bytes πmaxβ the max. allowed pre-allocation size π₯ (yes, "max." with the little period in there, iconic)
π DESCRIPTION π
So what does it actually do? It does pre-allocation for the given DMA buffer type. That's it, that's the whole thing β it's giving "simple, focused, main character energy" π no extra lore, just preallocate those pages for the DMA type you handed it.
β SEE ALSO β
The kernel file lives at ./sound/core/pcm_memory.c β go read it if you're feeling brave π§ and then check out the whole friend group:
snd_pcm_lib_preallocate_free(9)snd_pcm_lib_preallocate_free_for_all(9)snd_pcm_lib_preallocate_pages_for_all(9)snd_pcm_set_managed_buffer(9)snd_pcm_set_managed_buffer_all(9)snd_pcm_lib_malloc_pages(9)snd_pcm_lib_free_pages(9)
All of them, every single one, so you can free stuff and manage buffers like a responsible queen π
ngl if you preallocate you should also know how to free β that's literally why half of SEE ALSO exists π go read those too, bestie.
and that's the page!! πβ¨π this little gem lives in ./sound/core, dated October 2026, and it's filed under snd_pcm_lib...locate_pages(9) if you ever need to find it again π¦π
π«Ά
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms