Re: [PATCH v2 2/3] writeback: drop now-unnecessary rcu_barrier() in cgroup_writeback_umount()

From: Baokun Li

Date: Mon May 18 2026 - 09:25:01 EST


在 2026/5/18 21:01, Jan Kara 写道:
> On Sun 17-05-26 22:21:31, Baokun Li wrote:
>> Commit e1b849cfa6b6 ("writeback: Avoid contention on wb->list_lock when
>> switching inodes") replaced the queue_rcu_work() based scheduling of
>> inode wb switches with a plain queue_work(). Since then no switcher
>> goes through call_rcu(), so rcu_barrier() in cgroup_writeback_umount()
>> has no work to wait for and is effectively a no-op.
>>
>> Fixes: e1b849cfa6b6 ("writeback: Avoid contention on wb->list_lock when switching inodes")
>> Signed-off-by: Baokun Li <libaokun@xxxxxxxxxxxxxxxxx>
> Looks good. Just I think this should be folded in patch 1, since you have
> proper Fixes tag, I don't think there's a concern this would be backported
> to kernels where rcu_barrier() is still needed.
>
> Honza

Thank you for your review!

Because the two patches have different fix tags, there is concern that
removing rcu_barrier here could cause the stable branches still using
queue_rcu_work (5.10.y, 6.6.y, ...) to reintroduce similar issues when
the round of fix patches deletes this necessary synchronization.

Therefore, the patches are split into two to make their purposes clearer.


Cheers,
Baokun

>> ---
>> fs/fs-writeback.c | 5 -----
>> 1 file changed, 5 deletions(-)
>>
>> diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
>> index 1f95ddcee363..9ae290547eb2 100644
>> --- a/fs/fs-writeback.c
>> +++ b/fs/fs-writeback.c
>> @@ -1246,11 +1246,6 @@ void cgroup_writeback_umount(struct super_block *sb)
>> * will then drain it.
>> */
>> synchronize_rcu();
>> - /*
>> - * Use rcu_barrier() to wait for all pending callbacks to
>> - * ensure that all in-flight wb switches are in the workqueue.
>> - */
>> - rcu_barrier();
>> flush_workqueue(isw_wq);
>> }
>> }
>> --
>> 2.43.7
>>