linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Round up the average EC for recovered EB to defer their reuse
@ 2018-09-18 13:05 Andrew Worsley
  2018-09-18 13:05 ` [PATCH] Round UBI average erase count up to next integer Andrew Worsley
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Worsley @ 2018-09-18 13:05 UTC (permalink / raw)
  To: Artem Bityutskiy, Richard Weinberger, David Woodhouse,
	Brian Norris, Boris Brezillon, Marek Vasut,
	open list:UNSORTED BLOCK IMAGES (UBI),
	open list

We suggest rounding up the EC(Erase Count) for recovered EB(Erase Blocks) so
they are less likely than averaged to be re-used. The EBs which have lost their
EC header page and need to be reset are likely to be more worn than average
so it is better to use a larger than average number rather than less than
average number.

        Andrew Worsley

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] Round UBI average erase count up to next integer
  2018-09-18 13:05 Round up the average EC for recovered EB to defer their reuse Andrew Worsley
@ 2018-09-18 13:05 ` Andrew Worsley
  2018-09-18 14:31   ` Richard Weinberger
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Worsley @ 2018-09-18 13:05 UTC (permalink / raw)
  To: Artem Bityutskiy, Richard Weinberger, David Woodhouse,
	Brian Norris, Boris Brezillon, Marek Vasut,
	open list:UNSORTED BLOCK IMAGES (UBI),
	open list
  Cc: Andrew Worsley

Use a slightly larger than average EC so these PEBs will be
reinitialised with erase counts that make them less likely to
be reused than other (perhaps less worn or error-prone) PEBs

We have more frequent ECC failures on reads of page 0 of some PEBs
which manifest itself commonly during ubiattach. We believe this is due to
"program disturb" and want those PEB to be re-used later than average.

Signed-off-by: Andrew Worsley <amworsley@gmail.com>
---
 drivers/mtd/ubi/attach.c  | 2 +-
 drivers/mtd/ubi/fastmap.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c
index 93ceea4f27d5..f97e2ba56fb2 100644
--- a/drivers/mtd/ubi/attach.c
+++ b/drivers/mtd/ubi/attach.c
@@ -1414,7 +1414,7 @@ static int scan_all(struct ubi_device *ubi, struct ubi_attach_info *ai,
 
 	/* Calculate mean erase counter */
 	if (ai->ec_count)
-		ai->mean_ec = div_u64(ai->ec_sum, ai->ec_count);
+		ai->mean_ec = div_u64(ai->ec_sum+ai->ec_count-1, ai->ec_count);
 
 	err = late_analysis(ubi, ai);
 	if (err)
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index 462526a10537..91e513788f38 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -684,7 +684,7 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
 			be32_to_cpu(fmec->ec), 1);
 	}
 
-	ai->mean_ec = div_u64(ai->ec_sum, ai->ec_count);
+	ai->mean_ec = div_u64(ai->ec_sum+ai->ec_count-1, ai->ec_count);
 	ai->bad_peb_count = be32_to_cpu(fmhdr->bad_peb_count);
 
 	/* Iterate over all volumes and read their EBA table */
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Round UBI average erase count up to next integer
  2018-09-18 13:05 ` [PATCH] Round UBI average erase count up to next integer Andrew Worsley
@ 2018-09-18 14:31   ` Richard Weinberger
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Weinberger @ 2018-09-18 14:31 UTC (permalink / raw)
  To: Andrew Worsley
  Cc: Artem Bityutskiy, David Woodhouse, Brian Norris, Boris Brezillon,
	Marek Vasut, open list:UNSORTED BLOCK IMAGES (UBI),
	open list

Andrew,

Am Dienstag, 18. September 2018, 15:05:21 CEST schrieb Andrew Worsley:
> Use a slightly larger than average EC so these PEBs will be
> reinitialised with erase counts that make them less likely to
> be reused than other (perhaps less worn or error-prone) PEBs
> 
> We have more frequent ECC failures on reads of page 0 of some PEBs
> which manifest itself commonly during ubiattach. We believe this is due to
> "program disturb" and want those PEB to be re-used later than average.

So the general idea behind the patch is that we want to hold back PEBs
that lost the EC header since they must be less healthy than others?
More precisely such that this PEB will be less likely picked by find_mean_wl_entry().

Did you check, doesn't this make it more likely that such a "bad" PEB is more often
picked by wear leveling? It does not use find_mean_wl_entry().

Thanks,
//richard



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-09-18 14:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-18 13:05 Round up the average EC for recovered EB to defer their reuse Andrew Worsley
2018-09-18 13:05 ` [PATCH] Round UBI average erase count up to next integer Andrew Worsley
2018-09-18 14:31   ` Richard Weinberger

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).