From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5AB473AEF57 for ; Wed, 11 Mar 2026 07:46:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773215204; cv=none; b=rWDHxg9dze52UIiEcYAiIM+5EE1TTgeqeVDW7qCtBcH2BHMqbt143JuXTdSTLPoUkXH0ZJmQNOZMQDRTQ8khWTdPWZrRXxJEJFeDc9vnS9KsxQnfjNVDXczOcvvkEeock2kIxy94mLpAvV8qpcimN2004DHf/1iUDjDy9Of/SUM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773215204; c=relaxed/simple; bh=WdpvjVwZ8UoWbwedKQbAEwurp3cqbakyX9WQw6+rWZs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=vGmO1HRM5/OaevkilMwGa/EiR3322xzvazmeFu4oeHgbSkI/v3y0Lq69xSFH0/KjKn6I7mIfC7Z/I1l0ZU7ZfAUb/B8sbJAsUeG9qhX3ehp2Rm4jOFQl8ck7klA9K8vvOvbS5haPVRKSu9u829goycvLMhcK3ATb7JI0qo1Misw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=fqVB7uDK; arc=none smtp.client-ip=115.124.30.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="fqVB7uDK" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1773215190; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=fnKQLhya/8/ol29Ip/Cv2iq/b5XNSoCSvQJ1PLNKo/Y=; b=fqVB7uDKAAesV7ww0O8khS9sVWcQ8dvZETy7/jGYRqYv9H6qAq7rsylEFFffMQAAQUTRAjrx5JzsAYHg9J2jEPUpXGIsdbHHPNfuz1nmOspTawj1zaH8b+jF8rJJuu2+qIMDkv/s5oDGMFf/vzIFEfWqrt6wTciB/c4/x1LDVjE= Received: from 30.221.132.200(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0X-jFtFt_1773215189 cluster:ay36) by smtp.aliyun-inc.com; Wed, 11 Mar 2026 15:46:30 +0800 Message-ID: Date: Wed, 11 Mar 2026 15:46:29 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] erofs: use GFP_NOIO in endio decompression path of erofs To: jiucheng.xu@amlogic.com, Gao Xiang , Chao Yu , Yue Hu , Jeffle Xu , Sandeep Dhavale , Hongbo Li , Chunhai Guo Cc: linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org, jianxin.pan@amlogic.com, tuan.zhang@amlogic.com References: <20260311-origin-dev-v1-1-40524ef07ff0@amlogic.com> From: Gao Xiang In-Reply-To: <20260311-origin-dev-v1-1-40524ef07ff0@amlogic.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Jiucheng, On 2026/3/11 15:22, Jiucheng Xu via B4 Relay wrote: > From: Jiucheng Xu > > The endio decompression path of erofs calls vm_map_ram(). Due to updated subject: erofs: add GFP_NOIO in the bio completion if needed The bio completion path in the process context (e.g. dm-verity) will directly call into decompression rather than trigger another workqueue context for minimal scheduling latencies, which can then call vm_map_ram() with GFP_KERNEL. Due to insufficient memory, ... > insufficient memory, this function may generate memory swapping I/O, > which can cause submit_bio_wait to deadlock in some scenarios. > > Trimmed down the call stack, as follows: > > f2fs_submit_read_io > submit_bio //bio_list is initialized. > mmc_blk_mq_recovery > z_erofs_endio > vm_map_ram > __pte_alloc_kernel > __alloc_pages_direct_reclaim > shrink_folio_list > __swap_writepage > submit_bio_wait //bio_list is non-NULL, hang!!! > > Use memalloc_noio_{save,restore}() to wrap up this path. > > Signed-off-by: Jiucheng Xu Reviewed-by: Gao Xiang You can send a v2 to refine the subject and commit message. Thanks, Gao Xiang > --- > fs/erofs/zdata.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c > index 3977e42b9516861bf3d59c072b6b8aaa6898dd8a..fe8121df9ef2f2404fc6e3f0fbbd6367f9ec2c67 100644 > --- a/fs/erofs/zdata.c > +++ b/fs/erofs/zdata.c > @@ -1445,6 +1445,7 @@ static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io, > int bios) > { > struct erofs_sb_info *const sbi = EROFS_SB(io->sb); > + int gfp_flag; > > /* wake up the caller thread for sync decompression */ > if (io->sync) { > @@ -1477,7 +1478,9 @@ static void z_erofs_decompress_kickoff(struct z_erofs_decompressqueue *io, > sbi->sync_decompress = EROFS_SYNC_DECOMPRESS_FORCE_ON; > return; > } > + gfp_flag = memalloc_noio_save(); > z_erofs_decompressqueue_work(&io->u.work); > + memalloc_noio_restore(gfp_flag); > } > > static void z_erofs_fill_bio_vec(struct bio_vec *bvec, > > --- > base-commit: 11439c4635edd669ae435eec308f4ab8a0804808 > change-id: 20260311-origin-dev-1c9665798204 > > Best regards,