Re: [PATCH 5/5] btrfs: Increase buffer size for zlib functions

From: Josef Bacik
Date: Wed Nov 27 2019 - 08:54:11 EST


On Wed, Nov 27, 2019 at 01:14:23PM +0100, David Sterba wrote:
> On Tue, Nov 26, 2019 at 10:52:49AM -0500, Josef Bacik wrote:
> > On Tue, Nov 26, 2019 at 03:41:30PM +0100, Mikhail Zaslonko wrote:
> > > Due to the small size of zlib buffer (1 page) set in btrfs code, s390
> > > hardware compression is rather limited in terms of performance. Increasing
> > > the buffer size to 4 pages would bring significant benefit for s390
> > > hardware compression (up to 60% better performance compared to the
> > > PAGE_SIZE buffer) and should not bring much overhead in terms of memory
> > > consumption due to order 2 allocations.
> > >
> > > Signed-off-by: Mikhail Zaslonko <zaslonko@xxxxxxxxxxxxx>
> >
> > We may have to make these allocations under memory pressure in the IO context,
> > order 2 allocations here is going to be not awesome. If you really want it then
> > you need to at least be able to fall back to single page if you fail to get the
> > allocation. Thanks,
>
> The allocation is only for the workspace and it does not happen on the
> IO path for each call. There's the pool and if
>
> btrfs_get_workspace
> alloc_workspace
>
> fails, then there's fallback path to wait for an existing workspace to
> be free.

Only if we are maxed out, otherwise it tries to allocate. If it can happen it
will happen, and I'll be the guy swearing in the middle of the night trying to
deal with this making boxes fall over in production. I'm ok if we pre-allocate
them first and only do 1 page on-demand, but having it always this way will bite
us in the ass in production. Thanks,

Josef