Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp3716267rwb; Mon, 5 Sep 2022 17:32:31 -0700 (PDT) X-Google-Smtp-Source: AA6agR46N6qe4/ZMlqAHb3xa9SJP9vhkPY5Yj2V3YPyk1TW0ZDibYquTNOdyep1TRR+bc92kQYny X-Received: by 2002:a17:90a:6b0d:b0:1fa:c6fe:db6 with SMTP id v13-20020a17090a6b0d00b001fac6fe0db6mr22035261pjj.99.1662424351575; Mon, 05 Sep 2022 17:32:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662424351; cv=none; d=google.com; s=arc-20160816; b=n2OEId/us/f24FMEzLKnC2TdI8e3prkSlzRSuxcWK0LqwJ14cQF6oHDZlMfaafllkY +EVngCFH6VepchMLmDJ3sGHMrBU9tYcLiZLO9HgvkJIOu7tKishrW8b7w1fT80hjrV7h ATlZa77nW6OntaOFoaXLWRS7SXQ+y4y0m0+fDl07wNB9oprjnfA4OFr77pbcs8n3Eibt aERL4H8k7EK5Roum9UMcikcvmMNjlmSvtCH7KRUJG2HKcNv8tWwnM03IJxp97bnwczgs NSyKhl0KBeCKb5l8vGFAhpa7CG8bGwflUtUbZDJpWdkbTJJMDmMCz5l6ctuJKq2wbBQU hUKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=uoUrYGZzi+3lSG2HVCqGrSprixecUzyMBFpaMPP/HDI=; b=0Nk0XrDVJHb7hEnXO9Ou0BRLui0JkkLCdK+4hYcojwZKnjJCwxBazzFP9r1aoXaiTu HZAnRbGHSNJRwsycmfPt4myXaphe1n6gmmNifITxRoq4mqLqdHcX0MZ7ZvZoAG56+Hpt 0Fea8yD6K6dSoIHuYT/pK7y/783XQBSIZp8QGgoASwKxBOBjRSrut4vfQt5vFjTqJaVi hueTVHZsh0ZdT7LuEMMaNWjRIc0qw8Vt4p+YOUxcgtp//FUiFRqucU5+6bw9t+9pJ1Q+ ynvHwN7k14hX0OeSAnit1xwRN30AjRGJeTlZSNTosx/dkKBfTcWCHGKQ5pHqxR2mxhg9 s68g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=CdBJFs7W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a129-20020a624d87000000b0052ad5a71033si11685277pfb.91.2022.09.05.17.32.18; Mon, 05 Sep 2022 17:32:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=CdBJFs7W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231537AbiIFA3Z (ORCPT + 99 others); Mon, 5 Sep 2022 20:29:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229575AbiIFA3V (ORCPT ); Mon, 5 Sep 2022 20:29:21 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D62A67C97; Mon, 5 Sep 2022 17:29:19 -0700 (PDT) Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2860PN84029388; Tue, 6 Sep 2022 00:29:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=uoUrYGZzi+3lSG2HVCqGrSprixecUzyMBFpaMPP/HDI=; b=CdBJFs7Wmbr2Uzueb6exfhqNDJTk+c6uE8PHebVUAbul6nVJ86PHGCt9PtmAjopVwgry 5bDPExXYuzlNHITEaKYUL1+ggpil7VLO0kZSg4JrWNMAY5/1Nnm5OHk/zxEWx/o8R+PK Hb/yyloG2CSwaUWp3m5Xc070gCH1RWFfXaIFEf19xHDeOmIsBWtsLwbeg+B2U7NnTtIr +98fBsQr1Qp3Q4H86yW+jcS81Wi4FzgobVhQICtdhIC4kPGwGZkOxc+T347T9X3Qw7mC l7dFXO4e8aIC+Nzh8dZTTjUFpzDaH9gEPIBUqWJVlS25hfx6IpFvl+xNkYu4hwZpnPQp xQ== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3jcgu4uqg0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Sep 2022 00:29:16 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2860TFDt001872 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 6 Sep 2022 00:29:15 GMT Received: from [10.232.65.248] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Mon, 5 Sep 2022 17:29:14 -0700 Message-ID: <29577961-be15-3c33-c8db-5a92405a87f8@quicinc.com> Date: Tue, 6 Sep 2022 08:29:11 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.0.3 Subject: Re: [PATCH] fuse: fix the deadlock in race of reclaim path with kswapd To: Miklos Szeredi CC: , , References: <20220905071744.8350-1-quic_yingangl@quicinc.com> Content-Language: en-US From: Kassey Li In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: ojOd_1wwjhAHQb9mvvW03n801jW1Wy_t X-Proofpoint-ORIG-GUID: ojOd_1wwjhAHQb9mvvW03n801jW1Wy_t X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-05_16,2022-09-05_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 mlxscore=0 malwarescore=0 clxscore=1015 mlxlogscore=576 adultscore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2209060000 X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/5/2022 9:28 PM, Miklos Szeredi wrote: > On Mon, 5 Sept 2022 at 09:17, Kassey Li wrote: >> >> Task A wait for writeback, while writeback Task B send request to fuse. >> Task C is expected to serve this request, here it is in direct reclaim >> path cause deadlock when system is in low memory. >> >> without __GFP_FS in Task_C break throttle_direct_reclaim with an >> HZ timeout. >> >> kswpad (Task_A): writeback(Task_B): >> __switch_to+0x14c schedule+0x70 >> __schedule+0xb5c __fuse_request_send+0x154 >> schedule+0x70 fuse_simple_request+0x184 >> bit_wait+0x18 fuse_flush_times+0x114 >> __wait_on_bit+0x74 fuse_write_inode+0x60 >> inode_wait_for_writeback+0xa4 __writeback_single_inode+0x3d8 >> evict+0xa8 writeback_sb_inodes+0x4c0 >> iput+0x248 __writeback_inodes_wb+0xb0 >> dentry_unlink_inode+0xdc wb_writeback+0x270 >> __dentry_kill[jt]+0x110 wb_workfn+0x37c >> shrink_dentry_list+0x17c process_one_work+0x284 >> prune_dcache_sb+0x5c >> super_cache_scan+0x11c >> do_shrink_slab+0x248 >> shrink_slab+0x260 >> shrink_node+0x678 >> kswapd+0x8ec >> kthread+0x140 >> ret_from_fork+0x10 >> >> Task_C: >> __switch_to+0x14c >> __schedule+0xb5c >> schedule+0x70 >> throttle_direct_reclaim >> try_to_free_pages >> __perform_reclaim >> __alloc_pages_direct_reclaim >> __alloc_pages_slowpath >> __alloc_pages_nodemask >> alloc_pages >> fuse_copy_fill+0x168 >> fuse_dev_do_read+0x37c >> fuse_dev_splice_read+0x94 > > Should already be fixed in v5.16 by commit 5c791fe1e2a4 ("fuse: make > sure reclaim doesn't write the inode"). thanks for this info. > > Thanks, > Miklos