çå: çå: çå: [PATCH RFC] ubi: ubi_wl_get_peb: Replace a limited number of attempts with polling while getting PEB
From: chengzhihao
Date: Thu Aug 01 2019 - 09:19:41 EST
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@xxxxxx]
åéæé: 2019å8æ1æ 17:40
æää: chengzhihao <chengzhihao1@xxxxxxxxxx>
æé: zhangyi (F) <yi.zhang@xxxxxxxxxx>; linux-mtd <linux-mtd@xxxxxxxxxxxxxxxxxxx>; linux-kernel <linux-kernel@xxxxxxxxxxxxxxx>
äé: 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