mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Harmstone <mark@harmstone.com>
To: "JP Kobryn (Meta)" <jp.kobryn@linux.dev>,
	boris@bur.io, clm@fb.com, wqu@suse.com, dsterba@suse.com,
	linux-btrfs@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, linux-team@meta.com
Subject: Re: [PATCH 1/2] btrfs: additional gfp api for allocating compressed folios
Date: Fri, 20 Mar 2026 11:11:17 +0000	[thread overview]
Message-ID: <7a7f3bf5-da06-4fc5-bbf2-38eb9ad11803@harmstone.com> (raw)
In-Reply-To: <20260320073445.80218-2-jp.kobryn@linux.dev>

Reviewed-by: Mark Harmstone <mark@harmstone.com>

On 20/03/2026 7.34 am, JP Kobryn (Meta) wrote:
> btrfs_alloc_compr_folio() assumes all callers want GFP_NOFS. This is fine
> for most cases, however there are some call sites that would benefit from
> different flags. One such case is preventing direct reclaim from occurring
> during readahead allocations. With unbounded reclaim during this time,
> noticeable latency will occur under high memory pressure.
> 
> Provide an additional API that accepts one additional gfp_t parameter,
> giving callers flexibility over the characteristics of their allocation.
> 
> Signed-off-by: JP Kobryn (Meta) <jp.kobryn@linux.dev>
> ---
>   fs/btrfs/compression.c | 9 +++++++--
>   fs/btrfs/compression.h | 1 +
>   2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
> index 192f133d9eb5..ae9cb5b7676c 100644
> --- a/fs/btrfs/compression.c
> +++ b/fs/btrfs/compression.c
> @@ -180,7 +180,7 @@ static unsigned long btrfs_compr_pool_scan(struct shrinker *sh, struct shrink_co
>   /*
>    * Common wrappers for page allocation from compression wrappers
>    */
> -struct folio *btrfs_alloc_compr_folio(struct btrfs_fs_info *fs_info)
> +struct folio *btrfs_alloc_compr_folio_gfp(struct btrfs_fs_info *fs_info, gfp_t gfp)
>   {
>   	struct folio *folio = NULL;
>   
> @@ -200,7 +200,12 @@ struct folio *btrfs_alloc_compr_folio(struct btrfs_fs_info *fs_info)
>   		return folio;
>   
>   alloc:
> -	return folio_alloc(GFP_NOFS, fs_info->block_min_order);
> +	return folio_alloc(gfp, fs_info->block_min_order);
> +}
> +
> +struct folio *btrfs_alloc_compr_folio(struct btrfs_fs_info *fs_info)
> +{
> +	return btrfs_alloc_compr_folio_gfp(fs_info, GFP_NOFS);
>   }
>   
>   void btrfs_free_compr_folio(struct folio *folio)
> diff --git a/fs/btrfs/compression.h b/fs/btrfs/compression.h
> index 973530e9ce6c..6131c128dd21 100644
> --- a/fs/btrfs/compression.h
> +++ b/fs/btrfs/compression.h
> @@ -99,6 +99,7 @@ void btrfs_submit_compressed_read(struct btrfs_bio *bbio);
>   int btrfs_compress_str2level(unsigned int type, const char *str, int *level_ret);
>   
>   struct folio *btrfs_alloc_compr_folio(struct btrfs_fs_info *fs_info);
> +struct folio *btrfs_alloc_compr_folio_gfp(struct btrfs_fs_info *fs_info, gfp_t gfp);
>   void btrfs_free_compr_folio(struct folio *folio);
>   
>   struct workspace_manager {


  reply	other threads:[~2026-03-20 11:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-20  7:34 [PATCH 0/2] btrfs: prevent direct reclaim during compressed readahead JP Kobryn (Meta)
2026-03-20  7:34 ` [PATCH 1/2] btrfs: additional gfp api for allocating compressed folios JP Kobryn (Meta)
2026-03-20 11:11   ` Mark Harmstone [this message]
2026-03-20 17:55   ` David Sterba
2026-03-20  7:34 ` [PATCH 2/2] btrfs: prevent direct reclaim during compressed readahead JP Kobryn (Meta)
2026-03-20  7:36   ` Christoph Hellwig
2026-03-20 16:17     ` JP Kobryn (Meta)
2026-03-20 10:12   ` Qu Wenruo
2026-03-20 11:14     ` Mark Harmstone
2026-03-20 11:11   ` Mark Harmstone
2026-03-20 11:10 ` [PATCH 0/2] " Mark Harmstone

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7a7f3bf5-da06-4fc5-bbf2-38eb9ad11803@harmstone.com \
    --to=mark@harmstone.com \
    --cc=boris@bur.io \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=jp.kobryn@linux.dev \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-team@meta.com \
    --cc=wqu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome