mpol_to_str(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… mpol_to_str β€” the Kernel API Manual one ✨

okay so bestie, welcome to mpol_to_str(9) from the Kernel API Manual β€” this is the little guy that takes a mempolicy and makes it printable. no cap, it's giving "glow-up for a struct" πŸŽ€


🌸 NAME 🌸

mpol_to_str β€” format a mempolicy structure for printing πŸ’–

✨ SYNOPSIS ✨

void mpol_to_str (char *buffer , int maxlen , struct mempolicy *pol );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • buffer β€” the char buffer that's gonna contain the formatted mempolicy string. it's the canvas, she's the art 🎨
  • maxlen β€” length of buffer. yes, you gotta tell her how much room she has. be honest with her πŸ™ˆ
  • pol β€” pointer to the mempolicy that needs to be formatted. the main character, literally πŸ‘‘

πŸ’œ DESCRIPTION πŸ’œ

So what it does: it converts pol into a string. that's the whole vibe. 🫢

and if buffer is too short? she truncates the string. not a crash, not a meltdown, just a lil trim β€” but lowkey you don't want that, so listen up πŸ‘‡

the manpage recommends a maxlen of at least 51 for the longest mode, "weighted interleave", plus the longest flag, "relative|balancing", and also so you can display at least a few node ids. that's the 51 breakdown bestie, the math is mathing πŸ”₯

ngl, if you're eyeballing your buffer size, just give her the 51. don't do her dirty with some tiny buffer and then act surprised when it truncates πŸ’€

🌈 SEE ALSO 🌈

Kernel file ./mm/mempolicy.c, plus the whole friend group: numa_nearest_node(9), nearest_node_nodemask(9), folio_can_map_prot_numa(9), alloc_pages_mpol(9), vma_alloc_folio(9), alloc_pages(9), mpol_misplaced(9), mpol_shared_policy_init(9), mpol_parse_str(9) β€” iykyk, go read them, they're iconic 🧚


and that's the page! πŸ’… sign-off time: this one lives in ./mm πŸ“, dated October 2026 ⭐, and yeah β€” she's mpol_to_str(9) through and through. mwah πŸ’–βœ¨

πŸ“¦ where this page comes from