Re: [PATCH v7 3/5] rust: sync: Add abstraction for rcu_barrier()

From: Gary Guo

Date: Wed Jul 29 2026 - 14:50:06 EST


On Wed Jul 29, 2026 at 6:18 PM BST, Paul E. McKenney wrote:
> On Wed, Jul 29, 2026 at 11:45:40AM +0200, Philipp Stanner wrote:
>> rcu_barrier() is a frequently used C function which is always safe to be
>> called.
>
> Just checking... Here "always safe" means only from task level, with BH,
> preemption, and interrupts all enabled, correct?
>
> In contrast, if you do this:
>
> preempt_disable();
> rcu_barrier();
> preempt_enable();
>
> the results won't be safe.

This is same for all sleepable functions. In order to avoid having to mark all
sleeping function unsafe, we've decided that sleeping from non-preemptable
context is "safe", but is a bug regardless.

Best,
Gary