Re: [RFC] Removing b_end_io
From: Christoph Hellwig
Date: Tue Oct 27 2020 - 14:26:08 EST
On Sun, Oct 25, 2020 at 04:44:38AM +0000, Matthew Wilcox wrote:
>
> On my laptop, I have about 31MB allocated to buffer_heads.
>
> buffer_head 182728 299910 104 39 1 : tunables 0 0 0 : slabdata 7690 7690 0
>
> Reducing the size of the buffer_head by 8 bytes gets us to 96 bytes,
> which means we get 42 per page instead of 39 and saves me 2MB of memory.
>
> I think b_end_io() is ripe for removal. It's only used while the I/O
> is in progress, and it's always set to end_bio_bh_io_sync() which
> may set the quiet bit, calls ->b_end_io and calls bio_put().
>
> So how about this as an approach? Only another 40 or so call-sites
> to take care of to eliminate b_end_io from the buffer_head. Yes, this
> particular example should be entirely rewritten to do away with buffer
> heads, but that's been true since 2006. I'm looking for an approach
> which can be implemented quickly since the buffer_head does not appear
> to be going away any time soon.
I think this looks pretty reasonable.