linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: chengzhihao <chengzhihao1@huawei.com>
To: Richard Weinberger <richard@nod.at>
Cc: "zhangyi (F)" <yi.zhang@huawei.com>,
	linux-mtd <linux-mtd@lists.infradead.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: 答复: 答复: 答复: [PATCH RFC] ubi: ubi_wl_get_peb: Replace a limited number of attempts with polling while getting PEB
Date: Thu, 1 Aug 2019 13:19:28 +0000	[thread overview]
Message-ID: <0B80F9D4116B2F4484E7279D5A66984F7A8ACF@dggemi524-mbx.china.huawei.com> (raw)
In-Reply-To: <699614206.55882.1564652413789.JavaMail.zimbra@nod.at>

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:
--- 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) {

-----邮件原件-----
发件人: Richard Weinberger [mailto:richard@nod.at] 
发送时间: 2019年8月1日 17:40
收件人: chengzhihao <chengzhihao1@huawei.com>
抄送: zhangyi (F) <yi.zhang@huawei.com>; linux-mtd <linux-mtd@lists.infradead.org>; linux-kernel <linux-kernel@vger.kernel.org>
主题: 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

      reply	other threads:[~2019-08-01 13:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-01  9:17 [PATCH RFC] ubi: ubi_wl_get_peb: Replace a limited number of attempts with polling while getting PEB Zhihao Cheng
2019-08-01  9:13 ` 答复: " chengzhihao
2019-08-01  9:20   ` Richard Weinberger
2019-08-01  9:26     ` 答复: " chengzhihao
2019-08-01  9:40       ` Richard Weinberger
2019-08-01 13:19         ` chengzhihao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0B80F9D4116B2F4484E7279D5A66984F7A8ACF@dggemi524-mbx.china.huawei.com \
    --to=chengzhihao1@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=yi.zhang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).