From: Harry Yoo <harry@kernel.org>
To: Boris Burkov <boris@bur.io>
Cc: linux-btrfs@vger.kernel.org, kernel-team@fb.com,
Shakeel Butt <shakeel.butt@linux.dev>,
Kiryl Shutsemau <kas@kernel.org>,
linux-mm@kvack.org
Subject: Re: [PATCH] btrfs: add __GFP_NOFAIL to the kvmalloc in split_item
Date: Fri, 4 Dec 2026 11:33:32 +0000 [thread overview]
Message-ID: <axKhvYe05tcd0TEC@thinkstation> (raw)
In-Reply-To: <d70e510bb641c14e48c55a48cf4df518818bd03a.1796340717.git.boris@bur.io>
On Thu, Dec 03, 2026 at 03:36:53PM -0800, Boris Burkov wrote:
> The recent patch
> b2ba99cf6f7b ("btrfs: use kvmalloc() for b-tree split_item()")
>
> improved the behavior of the split_item() allocation for allocations of
> order >= 4. However, we have observed that it seems to regress the
> allocations of order 2 that are more typical for btrfs with 4k page
> size, 16k nodesize and crc32c checksums (split_item gets called from
> btrfs_del_csums only currently)
>
> I believe that this is caused by kvmalloc having a path for failing
> allocations (regardless of order) when fatal_signal_pending() is true on
> the task as checked by vm_area_alloc_pages():
>
> if (!(gfp & __GFP_NOFAIL) && fatal_signal_pending(current))
> break;
Right.
> reached by the following callchain:
> kvmalloc(item_size, GFP_NOFS)
> __kvmalloc_node_noprof()
> __do_kmalloc_node()
> __vmalloc_node_range_noprof()
> __vmalloc_area_node()
> vm_area_alloc_pages()
>
> This results in the same signature of an ENOMEM abort observed in the
> original patch:
>
> BTRFS: error (device dm-3 state A) in btrfs_del_csums:1053: errno=-12 Out of memory
> Link: https://lore.kernel.org/linux-btrfs/2ab022c5c7e07345a9fc91915836cbd4ab2d25ef.1788819456.git.wqu@suse.com/
In this case I think it's fair to specify __GFP_NOFAIL as failing to
allocate it leads to a disruption and there's no reasonable fallback.
https://lore.kernel.org/linux-mm/20211122153233.9924-3-mhocko@kernel.org
> I believe we could attempt to also fix this by having a mempool for this
> csum deletion temporary item buffer, but save that for a follow-up since
> this is a narrow fix for an immediate problem.
>
> Fixes: b2ba99cf6f7b ("btrfs: use kvmalloc() for b-tree split_item()")
> Signed-off-by: Boris Burkov <boris@bur.io>
> ---
For the kvmalloc() part, looks good to me, so:
Reviewed-by: Harry Yoo (Meta) <harry@kernel.org>
--
Cheers,
Harry / Hyeonggon
parent reply other threads:[~2026-12-04 11:33 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <d70e510bb641c14e48c55a48cf4df518818bd03a.1796340717.git.boris@bur.io>]
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=axKhvYe05tcd0TEC@thinkstation \
--to=harry@kernel.org \
--cc=boris@bur.io \
--cc=kas@kernel.org \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shakeel.butt@linux.dev \
/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