Linux XFS filesystem development
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>,
	Christian Brauner <brauner@kernel.org>,
	"Darrick J. Wong" <djwong@kernel.org>,
	linux-block@vger.kernel.org, linux-xfs@vger.kernel.org,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 1/2] block: pass a minsize argument to bio_iov_iter_bounce
Date: Thu, 30 Apr 2026 14:30:51 +0100	[thread overview]
Message-ID: <afNZi5HRDWtK9Wdx@casper.infradead.org> (raw)
In-Reply-To: <20260430132019.312405-2-hch@lst.de>

On Thu, Apr 30, 2026 at 03:20:04PM +0200, Christoph Hellwig wrote:
> -static struct folio *folio_alloc_greedy(gfp_t gfp, size_t *size)
> +static struct folio *folio_alloc_greedy(gfp_t gfp, size_t *size,
> +		size_t minsize)
>  {
>  	struct folio *folio;
>  
> -	while (*size > PAGE_SIZE) {
> +	while (*size > minsize) {
>  		folio = folio_alloc(gfp | __GFP_NORETRY, get_order(*size));
>  		if (folio)
>  			return folio;

Seems a bit inefficient.  How about something like this:

static struct folio *folio_alloc_greedy(gfp_t gfp, size_t *size, size_t minsize)
{
        unsigned int order = get_order(*size);
        unsigned int minorder = get_order(minsize);
        struct folio *folio;

        while (order > minorder) {
                folio = folio_alloc(gfp | __GFP_NORETRY, order);
                if (folio)
                        return folio;
                order--;
                *size = 1UL << order;
        }

        return folio_alloc(gfp, order);
}


  reply	other threads:[~2026-04-30 13:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-30 13:20 fix block layer bounce buffering for block size > PAGE_SIZE Christoph Hellwig
2026-04-30 13:20 ` [PATCH 1/2] block: pass a minsize argument to bio_iov_iter_bounce Christoph Hellwig
2026-04-30 13:30   ` Matthew Wilcox [this message]
2026-04-30 14:53     ` Christoph Hellwig
2026-05-01 12:46   ` Pankaj Raghav (Samsung)
2026-05-04  4:58     ` Christoph Hellwig
2026-04-30 13:20 ` [PATCH 2/2] block: align down bounces bios Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2026-05-07  5:01 fix block layer bounce buffering for block size > PAGE_SIZE v2 Christoph Hellwig
2026-05-07  5:01 ` [PATCH 1/2] block: pass a minsize argument to bio_iov_iter_bounce Christoph Hellwig
2026-05-07 11:36   ` Pankaj Raghav (Samsung)
2026-05-08  8:12     ` Christoph Hellwig
2026-05-11 10:40   ` Hannes Reinecke

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=afNZi5HRDWtK9Wdx@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=djwong@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /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