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

Josef Bacik
2019-11-27T13:50:48Z

On Wed, Nov 27, 2019 at 02:42:20PM +0100, Zaslonko Mikhail wrote:
> Hello,
>
> On 26.11.2019 16:52, 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@linux.ibm.com>
> >
> > 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,
> >
>
> As far as I understand GFP_KERNEL allocations would never fail for the order <=
> PAGE_ALLOC_COSTLY_ORDER. How else can the memory pressure condition be identified
> here?
>

Except these can be done under NOFS, and just because GFP_KERNEL probably won't
fail doesn't mean it won't cause problems accross the system at alloc time.
Half of our rebase time at Facebook is spent finding all the fun ways people
have abused memory allocations not thinking about how the system behaves under
memory pressure. Thanks,

Josef