* [PATCH] block: do not warn when doing greedy allocation in folio_alloc_greedy()
@ 2026-07-14 9:07 Qu Wenruo
2026-07-15 22:34 ` Jens Axboe
2026-07-16 9:29 ` Christoph Hellwig
0 siblings, 2 replies; 5+ messages in thread
From: Qu Wenruo @ 2026-07-14 9:07 UTC (permalink / raw)
To: linux-btrfs, linux-block
[WARNING]
During one of my local btrfs fstests runs, folio_alloc() inside
folio_alloc_greedy() triggered an allocation failure report when trying
to allocate an order-4 folio.
The kernel is from the latest development branch, which is utilizing
the IOMAP_DIO_BOUNCE flag for direct writes when the inode requires
checksum.
Unfortunately I didn't save the full log, only the function and the
order.
[CAUSE]
When the IOMAP_DIO_BOUNCE flag is utilized, we will hit the following call
chain:
bio_iov_iter_bounce_write()
|- folio_alloc_greedy()
|- folio_alloc(gfp | __GFP_NORETRY, get_order(*size));
However __GFP_NORETRY will still emit an allocation failure report
when it fails.
And folio_alloc_greedy() will retry with a smaller order anyway, there
is no point in emitting that allocation failure report.
[FIX]
Append the __GFP_NOWARN flag to folio_alloc() for the larger-order folio
attempts.
Fixes: 8dd5e7c75d7b ("block: add helpers to bounce buffer an iov_iter into bios")
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
block/bio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/block/bio.c b/block/bio.c
index f2a5f4d0a967..5ac954c70dd0 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1285,7 +1285,8 @@ static struct folio *folio_alloc_greedy(gfp_t gfp, size_t *size,
struct folio *folio;
while (*size > minsize) {
- folio = folio_alloc(gfp | __GFP_NORETRY, get_order(*size));
+ folio = folio_alloc(gfp | __GFP_NORETRY | __GFP_NOWARN,
+ get_order(*size));
if (folio)
return folio;
*size = rounddown_pow_of_two(*size - 1);
--
2.54.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] block: do not warn when doing greedy allocation in folio_alloc_greedy()
2026-07-14 9:07 [PATCH] block: do not warn when doing greedy allocation in folio_alloc_greedy() Qu Wenruo
@ 2026-07-15 22:34 ` Jens Axboe
2026-07-16 9:29 ` Christoph Hellwig
1 sibling, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2026-07-15 22:34 UTC (permalink / raw)
To: linux-btrfs, linux-block, Qu Wenruo
On Tue, 14 Jul 2026 18:37:39 +0930, Qu Wenruo wrote:
> [WARNING]
> During one of my local btrfs fstests runs, folio_alloc() inside
> folio_alloc_greedy() triggered an allocation failure report when trying
> to allocate an order-4 folio.
>
> The kernel is from the latest development branch, which is utilizing
> the IOMAP_DIO_BOUNCE flag for direct writes when the inode requires
> checksum.
>
> [...]
Applied, thanks!
[1/1] block: do not warn when doing greedy allocation in folio_alloc_greedy()
commit: daff723f2d4c618d5f9186a990f47bf75878abeb
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] block: do not warn when doing greedy allocation in folio_alloc_greedy()
2026-07-14 9:07 [PATCH] block: do not warn when doing greedy allocation in folio_alloc_greedy() Qu Wenruo
2026-07-15 22:34 ` Jens Axboe
@ 2026-07-16 9:29 ` Christoph Hellwig
2026-07-16 10:05 ` Vlastimil Babka (SUSE)
1 sibling, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2026-07-16 9:29 UTC (permalink / raw)
To: Qu Wenruo, Andrew Morton, Vlastimil Babka, Suren Baghdasaryan,
Michal Hocko, Brendan Jackman, Johannes Weiner, Zi Yan
Cc: linux-btrfs, linux-block, linux-mm
On Tue, Jul 14, 2026 at 06:37:39PM +0930, Qu Wenruo wrote:
> while (*size > minsize) {
> - folio = folio_alloc(gfp | __GFP_NORETRY, get_order(*size));
> + folio = folio_alloc(gfp | __GFP_NORETRY | __GFP_NOWARN,
> + get_order(*size));
I though I read somewhere that we now don't have to specify
__GFP_NOWARN when using __GFP_NORETRY, but a quick dive into the page
allocator suggest that no such thing exists.
But can we make it happen? Having to specify __GFP_NOWARN when the
caller clearly indicated that failure is perfectly fine using
__GFP_NORETRY is silly. The same probably applies to
__GFP_RETRY_MAYFAIL.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] block: do not warn when doing greedy allocation in folio_alloc_greedy()
2026-07-16 9:29 ` Christoph Hellwig
@ 2026-07-16 10:05 ` Vlastimil Babka (SUSE)
2026-07-16 10:33 ` Qu Wenruo
0 siblings, 1 reply; 5+ messages in thread
From: Vlastimil Babka (SUSE) @ 2026-07-16 10:05 UTC (permalink / raw)
To: Christoph Hellwig, Qu Wenruo, Andrew Morton, Suren Baghdasaryan,
Michal Hocko, Brendan Jackman, Johannes Weiner, Zi Yan,
Matthew Wilcox
Cc: linux-btrfs, linux-block, linux-mm
On 7/16/26 11:29, Christoph Hellwig wrote:
> On Tue, Jul 14, 2026 at 06:37:39PM +0930, Qu Wenruo wrote:
>> while (*size > minsize) {
>> - folio = folio_alloc(gfp | __GFP_NORETRY, get_order(*size));
>> + folio = folio_alloc(gfp | __GFP_NORETRY | __GFP_NOWARN,
>> + get_order(*size));
>
> I though I read somewhere that we now don't have to specify
> __GFP_NOWARN when using __GFP_NORETRY, but a quick dive into the page
> allocator suggest that no such thing exists.
There was a change a while ago that added __GFP_NOWARN to GFP_NOWAIT, maybe
that's what you read about?
> But can we make it happen? Having to specify __GFP_NOWARN when the
> caller clearly indicated that failure is perfectly fine using
> __GFP_NORETRY is silly. The same probably applies to
> __GFP_RETRY_MAYFAIL.
It makes sense to me. The risk of missing some useful warning due to a
coding error (conjuring up an unexpected __GFP_NORETRY/__GFP_RETRY_MAYFAIL
in whatever way and then silently failing) is probably low here and it makes
the API better.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] block: do not warn when doing greedy allocation in folio_alloc_greedy()
2026-07-16 10:05 ` Vlastimil Babka (SUSE)
@ 2026-07-16 10:33 ` Qu Wenruo
0 siblings, 0 replies; 5+ messages in thread
From: Qu Wenruo @ 2026-07-16 10:33 UTC (permalink / raw)
To: Vlastimil Babka (SUSE), Christoph Hellwig, Andrew Morton,
Suren Baghdasaryan, Michal Hocko, Brendan Jackman,
Johannes Weiner, Zi Yan, Matthew Wilcox
Cc: linux-btrfs, linux-block, linux-mm
在 2026/7/16 19:35, Vlastimil Babka (SUSE) 写道:
> On 7/16/26 11:29, Christoph Hellwig wrote:
>> On Tue, Jul 14, 2026 at 06:37:39PM +0930, Qu Wenruo wrote:
>>> while (*size > minsize) {
>>> - folio = folio_alloc(gfp | __GFP_NORETRY, get_order(*size));
>>> + folio = folio_alloc(gfp | __GFP_NORETRY | __GFP_NOWARN,
>>> + get_order(*size));
>>
>> I though I read somewhere that we now don't have to specify
>> __GFP_NOWARN when using __GFP_NORETRY, but a quick dive into the page
>> allocator suggest that no such thing exists.
>
> There was a change a while ago that added __GFP_NOWARN to GFP_NOWAIT, maybe
> that's what you read about?
>
>> But can we make it happen? Having to specify __GFP_NOWARN when the
>> caller clearly indicated that failure is perfectly fine using
>> __GFP_NORETRY is silly. The same probably applies to
>> __GFP_RETRY_MAYFAIL.
>
> It makes sense to me. The risk of missing some useful warning due to a
> coding error (conjuring up an unexpected __GFP_NORETRY/__GFP_RETRY_MAYFAIL
> in whatever way and then silently failing) is probably low here and it makes
> the API better.
Yep, making NORETRY and NOWAIT to imply NOWARN looks very reasonable to
me too.
Thanks,
Qu
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-07-16 10:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-14 9:07 [PATCH] block: do not warn when doing greedy allocation in folio_alloc_greedy() Qu Wenruo
2026-07-15 22:34 ` Jens Axboe
2026-07-16 9:29 ` Christoph Hellwig
2026-07-16 10:05 ` Vlastimil Babka (SUSE)
2026-07-16 10:33 ` Qu Wenruo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox