STRUCT DMEM_CGROUP_OPS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct dmem_cgroup_ops(9) πŸ’…

okay so this is a page from the Kernel API Manual, and it's all about one little struct: struct dmem_cgroup_ops β€” literally the operations table for a dmem cgroup region. bestie, it's giving "small but mighty." πŸŽ€


✨ NAME ✨

struct dmem_cgroup_ops β€” the operations for a dmem cgroup region. that's it, that's the whole vibe. πŸ¦‹


🌸 SYNOPSIS 🌸

struct dmem_cgroup_ops {
    int (*reclaim)(struct dmem_cgroup_pool_state *pool, u64
target_bytes, void *priv);
 };

look at her. one function pointer. main character energy honestly. πŸ‘‘


πŸ’– Members πŸ’–

  • reclaim β€” this one's optional (so no pressure, but also… slay if you implement it πŸ’…). it's the callback that gets invoked when dmem.max is set below the current usage of a pool. when that happens, the driver should attempt to free at least target_bytes from pool. and heads up β€” it may get called multiple times if usage is still above the limit after it returns. so like, don't assume it's a one-and-done situation, okay? πŸ”₯

🌈 Return 🌈

the return value of reclaim is doing a whole lot of storytelling, so let's break it down:

  • 0 β€” some progress was made. yes, even if you freed less than target_bytes. progress is progress, we celebrate it 🫢
  • -ENOSPC β€” no progress could be made at all. the caller will retry, but only up to a bounded number of times, so don't get too comfy 😭
  • another negative error code β€” a fatal error happened. this stops further reclaim attempts immediately. like, hard stop. no more retries. πŸ’€
fr fr, that last one is the dramatic exit β€” once you return a fatal negative error, the reclaim party is over.

🧚 SEE ALSO 🧚

  • Kernel file ./include/linux/cgroup_dmem.h
  • struct dmem_cgroup_init(9)

that's the whole page, babes β€” go forth and reclaim responsibly βœ¨πŸ’œ

β€” with love, from ./include/linux, October 2026 edition of the Kernel API Manual πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from