Re: [PATCH v2 1/1] mm/mmu_gather: replace IPI with synchronize_rcu() when batch allocation fails

From: Dave Hansen

Date: Tue Feb 24 2026 - 10:04:34 EST


On 2/24/26 03:41, Peter Zijlstra wrote:
>> +void tlb_remove_table_sync_rcu(void)
>> +{
>> + might_sleep();
>> + synchronize_rcu();
> synchronize_rcu() should end up in a might_sleep() at some point if it
> blocks (which it typically will).

FWIW, I do prefer the explicit might_sleep() rather than leaving it to
just the documentation. It just makes it easier to find bugs. I'm sure
there's some crazy RCU variant that doesn't often sleep in
synchronize_rcu(). ;)

If it's worth adding a line of comment, it's worth adding a line of code
to actually keep folks honest. This is also going to be a pretty darn
slow path so it shouldn't bloat anything too much.