Re: [PATCH] mm: backing-dev: use kfree_rcu() instead of synchronize_rcu_expedited()

From: Christoph Hellwig
Date: Fri Oct 15 2021 - 09:19:24 EST


On Fri, Oct 15, 2021 at 01:35:56PM +0100, Matthew Wilcox wrote:
> struct backing_dev_info {
> u64 id;
> - struct rb_node rb_node; /* keyed by ->id */
> + union {
> + struct rb_node rb_node; /* keyed by ->id */
> + struct rcu_head rcu;
> + };
> struct list_head bdi_list;
> unsigned long ra_pages; /* max readahead in PAGE_SIZE units */
> unsigned long io_pages; /* max allowed IO size */
>
>
> Christoph, independent of the inode lifetime problem, this actually seems
> like a good approach to take. I don't see why we should synchronize_rcu()
> here? Adding Jens (original introducer of the synchronize_rcu()), Mikulas
> (converted it to use _expedited) and Tejun (worked around a problem when
> using _expedited).

The kfree+rcu + your suggestion does seem like a good idea in general to
me. But I'd still like to fix the actual bug being reported before
optimizing the area in a way that papers over the bug.