misc_cg_max_write(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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", or 0, 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 β€” if buf is not valid. you gave it something it can't work with, and it's telling you πŸ’€
  • -ERANGE β€” if number is bigger than the u64 capacity. 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