list_lru_walk_one(9)
π
list_lru_walk_one (9) β Kernel API Manual π
okay bestie, welcome to the <pink>kernel API manual</pink> β¨ you're literally about to read the page for list_lru_walk_one, and honestly? it's giving "walk the LRU, isolate the freeable stuff, dispose of it" energy π let's get into it.
πΈ NAME πΈ
list_lru_walk_one β walk a @lru, isolating and disposing freeable items. periodt π
β¨ SYNOPSIS β¨
unsigned long list_lru_walk_one (struct list_lru *lru , int nid , struct
mem_cgroup *memcg , list_lru_walk_cb isolate , void *cb_arg , unsigned
long *nr_to_walk );
like, that's the whole signature, no cap π«Ά
π¦ ARGUMENTS π¦
lruβ the lru pointer. the main character of this whole function ngl πnidβ the node id you're scanning from. where we start, bestie πmemcgβ the cgroup you're scanning from. yes, that one πisolateβ callback function that is responsible for deciding what to do with the item currently being scanned. the vibe check, essentially π§cb_argβ opaque type that will be passed toisolate. it's a mystery to everyone except you, iykyk πnr_to_walkβ how many items to scan. how many to scan, mind you, more on that in a sec π
π DESCRIPTION π
so this function will scan <purple>all elements in a particular lru</purple>, calling the isolate callback for each of those items, along with the current list spinlock and a caller-provided opaque. yes, every single one of them β¨
the isolate callback can choose to drop the lock internally β but it *must* return with the lock held. like, that's the rule, that's the whole deal, no exceptions π₯
the callback will return an enum lru_status telling the lru infrastructure what to do with the object being scanned. it's literally the callback telling everybody else what's up π£
β οΈ bestie, please note: nr_to_walk does not mean how many objects will be freed. it means how many objects will be scanned. those are two different things and mixing them up is a whole tragedy π
β RETURN β
the number of objects effectively removed from the LRU. that's it, that's the number π
π SEE ALSO π
kernel file ./include/linux/list_lru.h π plus these icons:
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(9)list_lru_del_obj(9)list_lru_count_one(9)list_lru_walk_one_irq(9)
and that's the whole page, bestie, you ate that π«Ά this one lives over in ./include/linux, and it's dated <mint>October 2026</mint> β so yeah, mark your calendar, mwah πππ¦
π¦ 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