LWN: Comments on "The kernel's genpool subsystem" https://lwn.net/Articles/729653/ This is a special feed containing comments posted to the individual LWN article titled "The kernel's genpool subsystem". en-us Thu, 28 Aug 2025 23:57:57 +0000 Thu, 28 Aug 2025 23:57:57 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net The kernel's genpool subsystem https://lwn.net/Articles/883013/ https://lwn.net/Articles/883013/ ganesh45in <div class="FormattedComment"> Good article. Does this gen pool subsystem do defragmentation when we do a gen_pool_free? Lets say we have a 512 bytes of virtually contiguous memory added to the gen pool (memory allocated via vmalloc). Now we allocate 4 chunks of 128 bytes. Now, we free chunk 1 and 3 (0 and 2 still remain). Now we want to alloc 256 bytes of memory by calling gen_pool_alloc(256 bytes). We have a fragmented memory and there is no virtually contiguous 256 bytes of memory. Do we fail the alloc here?<br> </div> Fri, 28 Jan 2022 12:22:04 +0000 The kernel's genpool subsystem https://lwn.net/Articles/729959/ https://lwn.net/Articles/729959/ pH5 <div class="FormattedComment"> Embedded SoCs sometimes have on-chip SRAM that can be used to run suspend code while the external DRAM is disabled, or as a small but fast temporary working memory for GPUs or VPUs. The SRAM driver for example attaches a genalloc pool to an SRAM device, providing it to drivers in other subsystems as a shared resource. The other drivers can then obtain the pool via a reference in the device tree.<br> The VIDEO_CODA driver for example uses memory from such a pool to let the hardware video encoder do motion estimation in SRAM.<br> </div> Sat, 05 Aug 2017 12:14:10 +0000 The kernel's genpool subsystem https://lwn.net/Articles/729916/ https://lwn.net/Articles/729916/ Paf <div class="FormattedComment"> While others who work with hardware could presumably give you more (I do file systems...), the article touches on this:<br> "often that memory is located on a device somewhere".<br> <p> So yes, I think it is primarily special hardware needs. Some (hardware) devices have all kinds of weird needs like that - Memory aligned on odd boundaries, etc, because of the limited/specific ways the hardware has of addressing memory.<br> <p> But I would also be glad to hear more from someone who writes drivers...<br> </div> Fri, 04 Aug 2017 17:55:24 +0000 The kernel's genpool subsystem https://lwn.net/Articles/729837/ https://lwn.net/Articles/729837/ isido <div class="FormattedComment"> I like these articles on introducing kernel internals, so thank you is in order. One question: what are the typical use-cases and reasons for using custom allocators? Are they related to hardware idiosyncracies or some more general issue?<br> </div> Fri, 04 Aug 2017 06:13:51 +0000 The kernel's genpool subsystem https://lwn.net/Articles/729815/ https://lwn.net/Articles/729815/ blackwood <div class="FormattedComment"> I guess we could add drm_mm to the list of such allocators. That one even comes with pretty docs and all:<br> <p> <a href="https://dri.freedesktop.org/docs/drm/gpu/drm-mm.html#drm-mm-range-allocator">https://dri.freedesktop.org/docs/drm/gpu/drm-mm.html#drm-...</a><br> <p> But it's more a build-your-own-allocator thing than the more readymade genalloc: All the structs are exposed and can be embedded into our own structs.<br> <p> We've also have at least one driver (gma500) which uses the struct resource stuff to allocate/manage it's graphics bar with the vram.<br> </div> Thu, 03 Aug 2017 22:56:19 +0000