kfree_rcu_nolock(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… kfree_rcu_nolock β€” from the Kernel API Manual, section 9, bestie

Okay so picture this: it's giving "the chill version of kfree_rcu()" and honestly? iconic. Welcome to kfree_rcu_nolock(9), the page where RCU lets you free stuff from literally anywhere. Let's get into it 🫢


✨ NAME ✨

kfree_rcu_nolock β€” a version of kfree_rcu() that can be called in any context. Yes, any. No cap. πŸŽ€


🌸 SYNOPSIS 🌸

kfree_rcu_nolock (ptr , kvrhf );

That's it, that's the whole vibe. Two args, zero drama πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • ptr β€” pointer to kfree for double-argument invocations. Like, this is the thing you're yeeting into the void πŸ—‘οΈ
  • kvrhf β€” the name of the struct kvfree_rcu_head within the type of ptr. Yeah, it's a field name, not a value β€” read it carefully bestie, it matters πŸ”

πŸ’– DESCRIPTION πŸ’–

Okay so with KVFREE_RCU_BATCHED, kfree_rcu_nolock tries hard to free objects without any deferred processing β€” like it's genuinely making an effort, main character energy β€” but it may still defer freeing. So it's not a guarantee, it's a "probably" 😭

Also lowkey important: large kmalloc and vmalloc objects are always deferred. No exceptions, no shortcuts, periodt πŸ”₯

And the tea β˜•: kfree_rcu_nolock supports the 2-arg variant only. That's the whole menu, don't ask for more πŸ™ˆ

⚠️ Heads up bestie β€” "tries hard" β‰  "always does it". If your object is big (kmalloc or vmalloc), it's deferred, full stop. Don't build your whole design around it happening immediately πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘

This list is long, and the way I'm obsessed with it β€” grab a snack, we're going through all of them πŸ“

Kernel file ./include/linux/rcupdate.h, plus: same_state_synchronize_rcu(9), cond_resched_tasks_rcu_qs(9), rcu_softirq_qs_periodic(9), RCU_LOCKDEP_WARN(9), lockdep_assert_in_rcu_read_lock(9), lockdep_assert_in_rcu_read_lock_bh(9), lockdep_assert_in_rcu_read_lock_sched(9), lockdep_assert_in_rcu_reader(9), unrcu_pointer(9), RCU_INITIALIZER(9), rcu_assign_pointer(9), rcu_replace_pointer(9), rcu_access_pointer(9), rcu_dereference_check(9), rcu_dereference_bh_check(9), rcu_dereference_sched_check(9), rcu_dereference_all_check(9), rcu_dereference_protected(9), rcu_dereference(9), rcu_dereference_bh(9), rcu_dereference_sched(9), rcu_dereference_all(9), rcu_pointer_handoff(9), rcu_read_lock(9), rcu_read_unlock(9), rcu_read_lock_bh(9), rcu_read_unlock_bh(9), rcu_read_lock_sched(9), rcu_read_unlock_sched(9), RCU_INIT_POINTER(9), RCU_POINTER_INITIALIZER(9), kfree_rcu(9), kfree_rcu_mightsleep(9), rcu_head_init(9), rcu_head_after_call_rcu(9)


✨ that's the whole page, you ate that ✨

This little gem lives over in ./include/linux (the rcupdate.h corner of the world 🌈), and it's dated October 2026 β€” future-dated and fabulous, as she should be. Mwah πŸ’‹ πŸ§šβ€β™€οΈ

πŸ“¦ where this page comes from