STRUCT KFREE_RCU_CPU(9)
β¨ struct kfree_rcu_cpu(9) β¨
okay so this is a page straight out of the Kernel API Manual, and bestie, we're about to get deep into the RCU weeds π
πΈ NAME πΈ
struct kfree_rcu_cpu β batch up kfree_rcu() requests for an RCU grace period π
π¦ SYNOPSIS π¦
struct kfree_rcu_cpu {
struct kvfree_rcu_head *head;
unsigned long head_gp_snap;
atomic_t head_count;
struct list_head bulk_head[FREE_N_CHANNELS];
atomic_t bulk_count[FREE_N_CHANNELS];
struct kfree_rcu_cpu_work krw_arr[KFREE_N_BATCHES];
raw_spinlock_t lock;
struct delayed_work monitor_work;
bool initialized;
struct delayed_work page_cache_work;
atomic_t backoff_page_cache_fill;
atomic_t work_in_progress;
struct hrtimer hrtimer;
struct llist_head bkvcache;
int nr_bkv_objs;
};
like, look at her. so many fields. main character struct fr fr π
π Members π
headβ the list ofkfree_rcuobjects that are not yet waiting for a grace period. they're just chilling here for now β¨head_gp_snapβ a snapshot of the RCU state, taken for the objects that got placed onto"head"πΈhead_countβ how many objects are sitting in thercu_headsingular listbulk_headβ the bulk-list ofkvfree_rcuobjects not yet waiting for a grace periodbulk_countβ how many objects are in the bulk-listkrw_arrβ an array of batches ofkfree_rcuobjects waiting for a grace period β³lockβ synchronizes access to this structure (respect the lock, bestie π«Ά)monitor_workβ promotesheadtohead_freeafterKFREE_DRAIN_JIFFIESinitializedβ thercu_workfields have been initializedpage_cache_workβ a work item that refills the cache when it's emptybackoff_page_cache_fillβ delays the cache refillswork_in_progressβ says whetherpage_cache_workis currently runninghrtimerβ anhrtimerfor scheduling apage_cache_workbkvcacheβ a simple cache list holding objects for reuse purposes. and the way it saves per-cpu space is that the list is singular π even though it's lockless, an access still has to be protected by the per-cpu lock β οΈnr_bkv_objsβ the number of allocated objects atbkvcache
π Description π
so this is a per-CPU structure. the reason it's not tucked inside the rcu_data structure is so this code can be extracted from the RCU files β and that extraction could let the interactions with the slab allocators get further optimized. it's giving modular genius, honestly π§
β SEE ALSO β
Kernel file ./mm/slab_common.c
__kmem_cache_create_args(9), kmem_buckets_create(9), kmem_cache_shrink(9), kmem_dump_obj(9), kfree_sensitive(9), struct kvfree_rcu_bulk_data(9), struct kfree_rcu_cpu_work(9), kvfree_rcu_barrier(9), kvfree_rcu_barrier_on_cache(9)
ngl if you made it all the way down here you're lowkey an RCU icon now ππ¦
and that's the whole page, bestie β brought to you by ./mm πΈ from October 2026 π go drink some water and go touch a grace period β¨ periodt π
π¦ 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