From patchwork Thu Aug 1 13:19:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Zhihao Cheng X-Patchwork-Id: 1140478 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="i+W6cFAc"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45zrVs1xH3z9sMr for ; Thu, 1 Aug 2019 23:19:49 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nKxD7+nNOi2OS1cpOQplHKrYWaevnvd0eRIOxJ+Lm9g=; b=i+W6cFAcg2Q/+J R/a/Dblk34NjO3bdcEy3dXS9F1/K6YCh3cRqjwjJfqMG1bPkDcBH9ONVC7sYs5lM9AymjhYqpCx1+ ESkaDf/HL4+5IS4q18rUVMI+U2fmp3t2ioysK5EC8nHqkAQUjXxIWu/o16hZywqkjXVJGXbjeiezU 8nwvHgX387bPPcMb2c9EmjVfygekX/iPMTlHBCclHOvrNoQZGFBJxPPL0u7pqgtOpZw8Y/OOvdinE q4ePY9zZujoBg+XGDQnHqs694zIpmxfJBjhnlqIH4TDySizyASprSSHsZdlxsFtvUuWZAa0WNjRGo RDlzafPWkK6GT4eWI1EA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1htAzh-0002rl-Fu; Thu, 01 Aug 2019 13:19:45 +0000 Received: from szxga03-in.huawei.com ([45.249.212.189] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1htAzd-0002jY-Bw for linux-mtd@lists.infradead.org; Thu, 01 Aug 2019 13:19:43 +0000 Received: from dggemi402-hub.china.huawei.com (unknown [172.30.72.54]) by Forcepoint Email with ESMTP id AC0A2AF970FA64ACEA6D; Thu, 1 Aug 2019 21:19:36 +0800 (CST) Received: from DGGEMI524-MBX.china.huawei.com ([169.254.7.227]) by dggemi402-hub.china.huawei.com ([10.3.17.135]) with mapi id 14.03.0439.000; Thu, 1 Aug 2019 21:19:28 +0800 From: chengzhihao To: Richard Weinberger Subject: =?utf-8?b?562U5aSNOiDnrZTlpI06IOetlOWkjTogW1BBVENIIFJGQ10gdWJp?= =?utf-8?q?=3A_ubi=5Fwl=5Fget=5Fpeb=3A_Replace_a_limited_number_of_?= =?utf-8?q?attempts_with_polling_while_getting_PEB?= Thread-Topic: =?utf-8?b?562U5aSNOiDnrZTlpI06IFtQQVRDSCBSRkNdIHViaTogdWJp?= =?utf-8?q?=5Fwl=5Fget=5Fpeb=3A_Replace_a_limited_number_of_attempt?= =?utf-8?q?s_with_polling_while_getting_PEB?= Thread-Index: AQHVSEkuRooM7Daz00mNhjuG43MDw6bmAggAJrEe1mz+ynmUUMDzNiElvw0MLiA= Date: Thu, 1 Aug 2019 13:19:28 +0000 Message-ID: <0B80F9D4116B2F4484E7279D5A66984F7A8ACF@dggemi524-mbx.china.huawei.com> References: <1564651065-4585-1-git-send-email-chengzhihao1@huawei.com> <0B80F9D4116B2F4484E7279D5A66984F7A8A13@dggemi524-mbx.china.huawei.com> <1515821930.55881.1564651254907.JavaMail.zimbra@nod.at> <0B80F9D4116B2F4484E7279D5A66984F7A8A3A@dggemi524-mbx.china.huawei.com> <699614206.55882.1564652413789.JavaMail.zimbra@nod.at> In-Reply-To: <699614206.55882.1564652413789.JavaMail.zimbra@nod.at> Accept-Language: en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.177.224.82] MIME-Version: 1.0 X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190801_061941_724966_8FFFA5C9 X-CRM114-Status: UNSURE ( 8.77 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [45.249.212.189 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mtd , linux-kernel , "zhangyi \(F\)" Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org I have tested this extreme case(No free PEBs left after creating test volumes) on different type of machines for 100 times. The biggest number of attempts are shown below: x86_64 arm64 2-core 4 4 4-core 8 4 8-core 4 4 So, setting the number of attempts to 10 is fine. May I send another PATCH to improve it? Planned revisions: -----邮件原件----- 发件人: Richard Weinberger [mailto:richard@nod.at] 发送时间: 2019年8月1日 17:40 收件人: chengzhihao 抄送: zhangyi (F) ; linux-mtd ; linux-kernel 主题: Re: 答复: 答复: [PATCH RFC] ubi: ubi_wl_get_peb: Replace a limited number of attempts with polling while getting PEB ----- Ursprüngliche Mail ----- >> Do you have numbers how many attempts were needed to get a free block? > I tested it dozens of times. The biggest number of attempts I've ever > had so far is 6. In most cases, it only takes 2 or 3 times. So raising the retry count to, let's say, 10 would work too? Having it unbound feels dangerous because it may hide other problems. Thanks, //richard --- a/drivers/mtd/ubi/fastmap-wl.c +++ b/drivers/mtd/ubi/fastmap-wl.c @@ -221,12 +221,12 @@ int ubi_wl_get_peb(struct ubi_device *ubi) if (pool->used == pool->size) { spin_unlock(&ubi->wl_lock); - if (retried) { + retried++; + if (retried == 10) { ubi_err(ubi, "Unable to get a free PEB from user WL pool"); ret = -ENOSPC; goto out; } - retried = 1; up_read(&ubi->fm_eba_sem); ret = produce_free_peb(ubi); if (ret < 0) {