From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384014; b=fsZqeVcgPPNeejyzEd6AIq2X9itqTE+FNSK7dyr4lS56hX6lE3m+nRQIhFSrY8fPxvn9 1cp6fve0rBDQfsNHbZpGp0tv25tq+8MDdyWy4NkX6sQBbP58IUTFSNmt6wbLHyZviVdOk yAz+Wp191VcTRxMzW5svDLXOluSV6JcroT0japDOYSYIoBoYFWsy9r06wAA/MrdHBw/q+ 7rxBCoSS8n2cfIbhJleHaT0uAScvj/gd8JcgEdwBR3PJXjGOyd3tj6S4qve1O4WZ2NZM4 K6TFLAy4qp+g0evFyz0A6uF+uLlKI20YFSHKkRJ3yUfaV3LUrWJaMM83gyjb5LW/GHg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384014; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=Q64JBCpi30bAJjAPvpfWjl8npG3Acc6Dy3T/AwFahx8=; b=vLzB3Mgqoe2J8aGXkkc1bsHRrSXKQjIjXJZM/Qz18twVrhleIgNfGYvKJwEJ0wOlEP0c D0MzvqYxqXiu7mQSP03SsXMI9EVBu/8Ddyg+yE5RCCCRV/pr1K/DLHvnqra61OHNgAsdK JB+wQyV8aM4MylWfYxegZMxE9VsiD4GyBSrDe2AMoDqDd8Upbj/9Wdjsu4L/H4mQb0TuA SueF66eeYNmcXWJkwCKqHJrueWm+bh73b4h5VwosVbHDrJgzEUN/gOWDBzDJFIzmGozUQ 1SeC5U9KWh1afin5Mfa+xc7Tl2ciGTDl8EFZ08udtpgn9kaW8C1LXGgR46aD8gkQbuA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YYW6Rywu; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BFC1D606A32D for ; Fri, 4 Dec 2026 11:33:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YYW6Rywu Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19BAB1F000CE; Fri, 4 Dec 2026 11:33:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796384014; bh=Q64JBCpi30bAJjAPvpfWjl8npG3Acc6Dy3T/AwFahx8=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=YYW6Rywu9fdMhws6sMZO0J//bgnWjahIT3+pNB4Lu6EV96yRHs8/OJbOdC4bX/CR1 uL2pmf/WHFfhVt20ypqDrskn4K2x3ELL4rq9yWcIU6fwBFHuCFBZLGtgzqfRExldoW IS13atpUw5zVAY3Y/GwahuENmTAXE/VZpWSrsgvKI/2pNFFYpT7L+wzXiy9yaIjGY/ gLTRlPlREB25zgT39KLUgw7aBUGLOQiRGm9oQz8ryUspWaRjRbQ2krzLr1jyJgEuW9 ny+G2Tm7XNm0tpbBpFZU8RJvjJ0x3wsafPCvu6IzVpr/vXiYFU6bh9ZXKKfRs+s5to Zhn8yIoGzXJmQ== Date: Fri, 4 Dec 2026 11:33:32 +0000 From: Harry Yoo To: Boris Burkov Cc: linux-btrfs@vger.kernel.org, kernel-team@fb.com, Shakeel Butt , Kiryl Shutsemau , linux-mm@kvack.org Subject: Re: [PATCH] btrfs: add __GFP_NOFAIL to the kvmalloc in split_item Message-ID: References: X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 > --- For the kvmalloc() part, looks good to me, so: Reviewed-by: Harry Yoo (Meta) -- Cheers, Harry / Hyeonggon