list_lru_lock(9)
π 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 originalmemcgwas 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 πΈ
- Kernel file
./include/linux/list_lru.h folio_memcg_list_lru_alloc(9)list_lru_unlock(9)list_lru_add(9)list_lru_add_obj(9)list_lru_del(9)list_lru_del_obj(9)list_lru_count_one(9)list_lru_walk_one(9)list_lru_walk_one_irq(9)
mwah π β source/version is ./include/linux, date is October 2026. go lock that sublist, bestie, iykyk ππ
π¦ 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