IDR SYNC(9)
β¨ idr sync β¨
okay so this is from the Kernel API Manual, section 9, and it's literally called idr sync π
π idr synchronization (stolen from radix-tree.h)
bestie, listen. idr_find is able to be called locklessly, using RCU π the caller must ensure calls to this function are made within rcu_read_lock regions. periodt.
other readers (lock-free or otherwise) and modifications may be running concurrently, so likeβ¦ vibe check your assumptions before you go touching stuff π
π¦ the part where you still have to do your homework
it is still required that the caller manage the synchronization and lifetimes of the items. no cap, that's on you π«Ά
so if RCU lock-free lookups are used, typically this would mean that:
- the items have their own locks, or are amenable to lock-free access β¨
- and that the items are freed by RCU (or only freed after having been deleted from the idr tree and a
synchronize_rcugrace period) π
fr fr do not skip the lifetimes part. the kernel will not be cute about it π
π SEE ALSO
- Kernel file
./include/linux/idr.h IDR_INIT(9)DEFINE_IDR(9)idr_get_cursor(9)idr_set_cursor(9)idr_init_base(9)idr_init(9)idr_is_empty(9)idr_preload_end(9)idr_for_each_entry(9)idr_for_each_entry_ul(9)idr_for_each_entry_continue(9)idr_for_each_entry_continue_ul(9)ida_alloc(9)ida_alloc_min(9)ida_alloc_max(9)
π and that's the whole page, bestie β so iconic of you to read it. shoutout to ./include/linux for the source, dated October 2026, filed under idr sync(9). slay ππ¦β¨
π¦ 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