list_lru_lock(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ‘‘ list_lru_lock πŸ‘‘

okay bestie, welcome to list_lru_lock from the Kernel API Manual. this is the lock-the-right-sublist situation, and yes, it's giving main character energy. let's get into it πŸ’…βœ¨

πŸŽ€ NAME πŸŽ€

list_lru_lock β€” lock the sublist for the given node and memcg. periodt. πŸ”’

πŸ¦‹ SYNOPSIS πŸ¦‹

struct list_lru_one * list_lru_lock (struct list_lru *lru , int nid ,
struct mem_cgroup **memcg );

πŸ’– ARGUMENTS πŸ’–

  • lru β€” the lru pointer. that's literally the pointer, bestie 🫢
  • nid β€” the node id of the sublist to lock. slay, we love a specific sublist πŸ”₯
  • memcg β€” pointer to the cgroup of the sublist to lock. on return, it gets updated to the cgroup whose sublist was actually locked β€” and plot twist, that may be an ancestor if the original memcg was dying 😭

✨ DESCRIPTION ✨

Returns the locked list_lru_one sublist. the caller must call list_lru_unlock when done β€” yes, you have to give it back, no ghosting πŸ’€

You must ensure that the memcg is not freed during this call (e.g., with rcu or by taking a css refcnt). this is the β€œdo not let it vanish mid-lock” rule, fr fr β€” keep it alive with rcu or a css refcnt, or it's bad vibes 🚨

πŸ”₯ RETURN πŸ”₯

the locked list_lru_one, or NULL on failure. that's the whole vibe: you either got the locked sublist or you got NULL, no in-between 🌈

🌸 SEE ALSO 🌸


mwah πŸ’‹ β€” source/version is ./include/linux, date is October 2026. go lock that sublist, bestie, iykyk πŸ‘‘πŸŽ€

πŸ“¦ where this page comes from