misc_cg_max_write(9)
π misc_cg_max_write(9) β the cgroup glow-up manual (Kernel API Manual)
okay so bestie, you found misc_cg_max_write(9), and honestly? it's giving "small function, big responsibility" β¨ this is the kernel API manual version, and we're gonna walk through it together, no cap π«Ά
πΈ NAME πΈ
misc_cg_max_write β updates the maximum limit of the cgroup. that's it, that's the whole job. iconic, honestly π
β¨ SYNOPSIS β¨
ssize_t misc_cg_max_write (struct kernfs_open_file *of , char *buf ,
size_t nbytes , loff_t off );
look at that signature. four args, one ssize_t coming back at you. slay π
π ARGUMENTS π
ofβ handler for the file. your little passport to the kernfs file, basically π¦bufβ the data from the user. and listen, it has to be either"max", or0, or a positive integer. no vibes-based input allowed, the vibe check is strict πnbytesβ number of bytes of the data. yes, somebody's counting πoffβ offset in the file. where you are in the file, lowkey πΊοΈ
π DESCRIPTION π
so the user can pass data like:
echo sev 23 > misc.max
OR
echo sev max > misc.max
both are valid, both are welcome, we love options π
π§ CONTEXT π§
Any context. literally any. no restrictions, no dress code, come as you are π
π₯ RETURN π₯
>= 0β number of bytes processed in the input. good vibes, successful run β-EINVALβ ifbufis not valid. you gave it something it can't work with, and it's telling you π-ERANGEβ if number is bigger than theu64capacity. too much!! overflowing!! the number ate too much and now it's out of range π
π SEE ALSO π
Kernel file ./kernel/cgroup/misc.c, plus the whole friend group:
parent_misc(9), valid_type(9), misc_cg_set_capacity(9), misc_cg_cancel_charge(9), misc_cg_try_charge(9), misc_cg_uncharge(9), misc_cg_max_show(9), misc_cg_current_show(9), misc_cg_peak_show(9), misc_cg_capacity_show(9), misc_cg_alloc(9), misc_cg_free(9)
like, the whole squad showed up for this one π«Άβ¨
and that's the page, bestie π it lives in ./kernel/cgroup, dated October 2026, and it's misc_cg_max_write(9) forever and always. periodt πΈπ
π¦ 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