Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2698365iog; Mon, 27 Jun 2022 00:33:40 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vIUd93v96qO5Crt4zEG8Hq8I9D8umFs1wIVJwBfnokl9io4Bsn92wvKpQg4VBTYNQ2Oc9J X-Received: by 2002:a17:902:8a91:b0:167:621f:9749 with SMTP id p17-20020a1709028a9100b00167621f9749mr13188927plo.9.1656315219880; Mon, 27 Jun 2022 00:33:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656315219; cv=none; d=google.com; s=arc-20160816; b=yftmPDHJYbiT2iFYNjBxuyzAh29cWdre7bD7P6ZC1KCNBR41vaigbS9N5hOUthcn66 fR0YvYqZJy2p7xDnMypU4wLjJjohJXT9GVnzA5T0YYA6tFhp2w3joZmw4aUME41tY7u6 eRei4xmRz23GOdn591yn2QeuiTPcniZWFLVelApwhbixOlh6NT/o/bc8AYFS4p0azdTX CHtJ6dCywSaTchfqVjTvBDhmH942sj+0UqbfZOGqqanMwSNUhITqrp/0/yKOOqnkEFWJ 54Ak9pRgdwuzx9kqyhexJiPITO7SXkJ/g8o+TAr+jOnxQgXY7z5hDO/oVuBjrXh3Xdhf 5fyw== 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 :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=vrPliqBnBe7SRpSLtXpVK53P28ahjhvkGGMU3huObmY=; b=jPOgupEgHp5GJo8YgPM4Wfw/KtqRqSeZvJs+sB6Y65ntvEUk86HVkraQsPYBm+fm/e lYYoz8a/NfTSbIEtT1ErNulAgTMbM61y1KNSbgX6p3Zzf/q7FokaTL/qcmSX9kbi6u/P t+oZ4/sudCo3sb6qZ59mxSAlWLkiI/2qexd0+TKAOBHjMZJfNAXo+b7znETRNXNm58LX Pfx4ivafBS7vntu3ZsDbr/AUk2DJ7LGlP9QnHRWEDs2Afl+JyS+FpuKuqEBGu/mzT5oP UQCYMHyFnCirYuWS5HtnTxymzmm9kMz+EMqkoTG3pinRmlG1qCOZVhQJhu3zqQSrm3ZO TArw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z2-20020a170902ccc200b0016b7b1396cesi3509022ple.419.2022.06.27.00.33.28; Mon, 27 Jun 2022 00:33:39 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232553AbiF0HLQ (ORCPT + 99 others); Mon, 27 Jun 2022 03:11:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229986AbiF0HLP (ORCPT ); Mon, 27 Jun 2022 03:11:15 -0400 Received: from mail.meizu.com (edge07.meizu.com [112.91.151.210]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBA6A267E for ; Mon, 27 Jun 2022 00:11:13 -0700 (PDT) Received: from IT-EXMB-1-125.meizu.com (172.16.1.125) by mz-mail11.meizu.com (172.16.1.15) with Microsoft SMTP Server (TLS) id 14.3.487.0; Mon, 27 Jun 2022 15:11:05 +0800 Received: from [172.16.32.26] (172.16.32.26) by IT-EXMB-1-125.meizu.com (172.16.1.125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.14; Mon, 27 Jun 2022 15:11:04 +0800 Message-ID: Date: Mon, 27 Jun 2022 15:11:04 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH] erofs: wake up all waiters after z_erofs_lzma_head ready Content-Language: en-US To: CC: , , , References: <20220626224041.4288-1-chenyuwen1@meizu.com> From: Yuwen Chen In-Reply-To: <20220626224041.4288-1-chenyuwen1@meizu.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [172.16.32.26] X-ClientProxiedBy: IT-EXMB-1-126.meizu.com (172.16.1.126) To IT-EXMB-1-125.meizu.com (172.16.1.125) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, 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 The new patch has been upload. The modification points are as follower: 1. delete the period. 2. change 'W' to lowercase. 3. add a Reviewed-by tag. On 6/27/22 06:40, Yuwen Chen wrote: > When the user mounts the erofs second times, the decompression thread > may hung. The problem happens due to a sequence of steps like the > following: > > 1) Task A called z_erofs_load_lzma_config which obtain all of the node > from the z_erofs_lzma_head. > > 2) At this time, task B called the z_erofs_lzma_decompress and wanted to > get a node. But the z_erofs_lzma_head was empty, the Task B had to > sleep. > > 3) Task A release nodes and push nodes into the z_erofs_lzma_head. But > task B was still sleeping. > > One example report when the hung happens: > task:kworker/u3:1 state:D stack:14384 pid: 86 ppid: 2 flags:0x00004000 > Workqueue: erofs_unzipd z_erofs_decompressqueue_work > Call Trace: > > __schedule+0x281/0x760 > schedule+0x49/0xb0 > z_erofs_lzma_decompress+0x4bc/0x580 > ? cpu_core_flags+0x10/0x10 > z_erofs_decompress_pcluster+0x49b/0xba0 > ? __update_load_avg_se+0x2b0/0x330 > ? __update_load_avg_se+0x2b0/0x330 > ? update_load_avg+0x5f/0x690 > ? update_load_avg+0x5f/0x690 > ? set_next_entity+0xbd/0x110 > ? _raw_spin_unlock+0xd/0x20 > z_erofs_decompress_queue.isra.0+0x2e/0x50 > z_erofs_decompressqueue_work+0x30/0x60 > process_one_work+0x1d3/0x3a0 > worker_thread+0x45/0x3a0 > ? process_one_work+0x3a0/0x3a0 > kthread+0xe2/0x110 > ? kthread_complete_and_exit+0x20/0x20 > ret_from_fork+0x22/0x30 > > > Signed-off-by: Yuwen Chen > Reviewed-by: Gao Xiang > --- > fs/erofs/decompressor_lzma.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/fs/erofs/decompressor_lzma.c b/fs/erofs/decompressor_lzma.c > index 05a3063cf2bc..5e59b3f523eb 100644 > --- a/fs/erofs/decompressor_lzma.c > +++ b/fs/erofs/decompressor_lzma.c > @@ -143,6 +143,7 @@ int z_erofs_load_lzma_config(struct super_block *sb, > DBG_BUGON(z_erofs_lzma_head); > z_erofs_lzma_head = head; > spin_unlock(&z_erofs_lzma_lock); > + wake_up_all(&z_erofs_lzma_wq); > > z_erofs_lzma_max_dictsize = dict_size; > mutex_unlock(&lzma_resize_mutex);