list_lru_del(9)
π list_lru_del β deleting things from the LRU list, but make it a whole vibe β¨
okay bestie, so this is a page from the Kernel API Manual, and we're talking about list_lru_del(9) β your new favorite way to take an element OUT of the lru list. no cap, it's lowkey iconic. π
πΈ NAME πΈ
list_lru_del β delete an element from the lru list. literally that's it, she does one thing and she does it well π
β¨ SYNOPSIS β¨
bool list_lru_del (struct list_lru *lru , struct list_head *item , int
nid , struct mem_cgroup *memcg );
π¦ ARGUMENTS π¦
lruβ the lru pointer. main character energy tbh π«Άitemβ the item to be deleted. bye bestie πnidβ the node id of the sublist to delete the item from. gotta know which sublist we're dealing with πmemcgβ the cgroup of the sublist to delete the item from. keep up with the groups fr fr
π₯ DESCRIPTION π₯
So this function works analogously as list_lru_add in terms of list manipulation. same vibe, opposite direction, iykyk π
And here's the tea: the comments in list_lru_add about an element already being in a list are also valid for list_lru_del. that means you can delete an item that has already been removed or never been added. chaotic but it's fine, no notes π
BUT (yes there's a but, there's always a but π) β if the item is in a list, it must be in this list, and you must pass the right value of nid and memcg so that the right sublist is used. wrong sublist = wrong vibe = not slay π
Now listen up because this part matters: you must ensure that the memcg is not freed during this call (e.g., with rcu or by taking a css refcnt). this is not the moment to get sloppy, bestie π¨
When a memcg is deleted, list_lru entries are automatically moved to the parent memcg. This is done in a race-free way, so during deletion of an memcg both the old and new memcg will resolve to the same sublist internally. like a glow-up where the old and new version are secretly the same girlie β iconic behavior π
β RETURN β
trueif the list was updated πfalseotherwise π
π§ SEE ALSO π§
Kernel file ./include/linux/list_lru.h and its whole friend group:
folio_memcg_list_lru_alloc(9)list_lru_lock(9)list_lru_unlock(9)list_lru_add(9)list_lru_add_obj(9)list_lru_del_obj(9)list_lru_count_one(9)list_lru_walk_one(9)list_lru_walk_one_irq(9)
okay that's the whole page, go forth and delete responsibly ππ
from ./include/linux β October 2026 edition β mwah, ily, see u in the kernel π«Άβ¨
π¦ 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