Skip to contentSkip to conversation

a way to reduce memory usage

JFFS2 Dmitry Bazhenov 2 participants 4 messages Jun 15, 2006 – Jun 19, 2006 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Hello all!

As I understand, for the moment every reference to raw node is kept in-core, even for obsoleted one. I think it is a bit excessive.

I have an idea how to reduce the amount of references kept in-core. It requires some terminology:

Raw nodes are classified as:
- valid
Node is still used. The block owning a valid node couldn't be erased.
- significant
A significant node is obsolete but we must consider it exists. The block owning a significant node can be erased. A significant node must be kept in memory until the owning block is erased.
- insignificant
A insignificant node is obsolete and may not be kept in memory any more.

As you can see, I introduced a new state of node "significant". The amount of significant nodes is less than total amount, thus we can reduce memory usage by releasing all references to insignificant nodes.

Below are the rules to determine validness/significance of a certain node. I have made rules for dirent and data nodes only:
- Node is "obsoleted in block" if it is obsoleted by
subsequent nodes in the same block.
- Node is "globally obsoleted" if it is obsoleted by
subsequent nodes that are not in the same block.
- Normal dirent or data node is valid if it is neither
"globally obsoleted" nor "obsoleted in block".
- Normal dirent or data node is significant if it is
"globally obsoleted" but is not "obsoleted in block", and the block is not erased.
- Deletion dirent is valid if it is neither "globally
obsoleted" nor "obsoleted in block", and
is not the only dirent in inode.
- Deletion dirent is significant if it is the only
dirent in inode and the block is not erased.

I think that the same rules can be applied to other kinds of nodes.

What do you think?

--
Dmitry

#1 lore raw
Quoted 2 lines · Dmitry Bazhenov

As I understand, for the moment every reference to raw node is kept in-core, even for obsoleted one. I think it is a bit excessive.

If you build without TEST_TOTLEN defined, we've already halved the size of the struct jffs2_raw_node_ref in the last few weeks. As well as finally removing the 'totlen' memory, we've also removed the 'next_phys' pointer and we're using arrays of them instead. That does mean that we can no longer drop obsolete nodes from the list though. However, we were only actually doing that on NOR flash anyway, because on NAND we do need access to obsolete dirent nodes.

Signature · 1 line
dwmw2
#2 lore raw
Quoted 7 lines
Quoted 2 lines

As I understand, for the moment every reference to raw node is kept in-core, even for obsoleted one. I think it is a bit excessive.

... However, we were
only actually doing that on NOR flash anyway, because on NAND we do need access to obsolete dirent nodes.

The algorithm allows to leave in memory only references to those nodes, that can affect future functionality, but to free references to all other nodes. The algorithm is appliable for the case of NAND chips also.

--
Dmitry