[RFC PATCH 2/2] mtd: ubi: wl: avoid erasing a PEB which is empty
Artem Bityutskiy
dedekind1 at gmail.com
Tue Nov 24 07:58:17 EST 2015
On Mon, 2015-11-23 at 19:09 +0100, Sebastian Andrzej Siewior wrote:
> wear_leveling_worker() currently unconditionally puts a PEB on erase
> in
> the error case even it just been taken from the free_list and never
> used.
> In case the PEB was never used it can be put back on the free list
> saving an erase cycle.
Did you think about putting LEBs like that to the protection queue
instead of playing tricks with scheduler?
The protection queue is there in order to protect eraseblocks from the
wear-leveling subsystem (not the best choice of words, but terminology
could be improved separately)
And this is what you need - you want the wear-leveling subsystem to
leave the eraseblock alone for some time, right?
The protection queue uses the erase cycles counts instead of the actual
time, but this seems OK for the situation you described.
Just to remind why this protection queue exists - when the WL subsystem
gives an eraseblock to the user, this may be an eraseblock with a high
erase counter, and it may be a candidate for being moved, the WL
subsystem just did not have a chance to do this yet. But if we give the
eraseblock to the user, the user will probably write something there
soon, and we do not want the WL subsystem to initiate data relocation
while the user is writing the data there. Instead, we want to wait a
little, and then move the data in background without interfering with
the user.
Back to my idea - what if you add the MOVE_RETRY eraseblocks to the
protection queue. May be not to the tail, may be to the head.
More information about the linux-mtd
mailing list