public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: why is jiffies 128 in jffs2_find_gc_block() in gc.c of jffs2
@ 2005-07-22  4:44 krishna
  2005-07-22 15:55 ` David Woodhouse
  0 siblings, 1 reply; 2+ messages in thread
From: krishna @ 2005-07-22  4:44 UTC (permalink / raw)
  To: Josh Boyer, Linux Kernel

Hi,

Thak you very much.

I am not clear why the hardcoded values are 50, 110 and 126
and why is jiffies moded with 128, why not any other value.

Regards,
Krishna Chaitanya

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

* Re: why is jiffies 128 in jffs2_find_gc_block() in gc.c of jffs2
  2005-07-22  4:44 why is jiffies 128 in jffs2_find_gc_block() in gc.c of jffs2 krishna
@ 2005-07-22 15:55 ` David Woodhouse
  0 siblings, 0 replies; 2+ messages in thread
From: David Woodhouse @ 2005-07-22 15:55 UTC (permalink / raw)
  To: krishna; +Cc: linux-mtd, Josh Boyer, Linux Kernel

On Fri, 2005-07-22 at 10:14 +0530, krishna wrote:
> I am not clear why the hardcoded values are 50, 110 and 126
> and why is jiffies moded with 128, why not any other value.

It's just a way to achieve 'randomness' which doesn't actually consume
entropy and which is quick to obtain. It only needs to be relatively
evenly distributed.

We use it for selecting the next eraseblock to be garbage-collected.
50/128 of the time we pick a block from the eraseable_list, 60/128 of
the time we pick a block from the very_dirty_list, 16/128 of the time we
pick a block from the dirty_list, and the remaining 2/128 of the time we
pick a block from the clean_list for garbage collection.

The precise numbers don't have a huge amount of science behind them;
they are mostly guesses about what would achieve evenly-distributed wear
levelling over time without garbage-collecting clean blocks more often
than is necessary.

If you want to conduct tests with various workloads in order to refine
the fairly primitive algorithm described above, that could be useful.

-- 
dwmw2


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

end of thread, other threads:[~2005-07-22 15:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-22  4:44 why is jiffies 128 in jffs2_find_gc_block() in gc.c of jffs2 krishna
2005-07-22 15:55 ` David Woodhouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox