Re: [PATCH 1/2] Squashfs: add XZ compression support

From: Lasse Collin
Date: Fri Dec 10 2010 - 17:48:44 EST


On 2010-12-09 Phillip Lougher wrote:
> + stream->state = xz_dec_init(XZ_PREALLOC, block_size);

This sets the preallocated LZMA2 dictionary size to Squashfs block size,
which allows the best compression ratio for the given block size (bigger
values would be waste of memory). XZ decompressor needs about 30 KiB of
memory plus the dictionary. So with 1 MiB Squashfs block size a little
over 1 MiB of memory is needed by the XZ decompressor.

Would it be useful to support smaller dictionaries without reducing the
Squashfs block size? It would save RAM while increasing the Squashfs
image size less than if also the block size was reduced. Reasonable
dictionary sizes could be e.g. 75 %, 50 %, or 25 % of the Squashfs block
size. The size increase of the Squashfs image will vary a lot depending
on the files in it, but e.g. dict_size = block_size / 2 won't
necessarily increase the image size more than 1 %.

I don't know if this kind of RAM savings matter on embedded systems. I
hope someone else can comment. My point in this email is only to let
others know that reducing the RAM usage is possible without reducing the
Squashfs block size.

--
Lasse Collin | IRC: Larhzu @ IRCnet & Freenode
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/