aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/decompress.c
diff options
context:
space:
mode:
authorKyungsik Lee <kyungsik.lee@lge.com>2013-10-07 09:40:35 +0200
committerJan Beulich <jbeulich@suse.com>2013-10-07 09:40:35 +0200
commite850049bbc831bfe40b87eaea673675d8a829e74 (patch)
tree39585eab8bdef2dc999b2837efd404a231c9e2d3 /xen/common/decompress.c
parent8e0da8c07f4f80e14314977a11f738bd74a5b62b (diff)
downloadxen-e850049bbc831bfe40b87eaea673675d8a829e74.tar.gz
xen-e850049bbc831bfe40b87eaea673675d8a829e74.tar.bz2
xen-e850049bbc831bfe40b87eaea673675d8a829e74.zip
xen: add LZ4 decompression support
Add support for LZ4 decompression in Xen. LZ4 Decompression APIs for Xen are based on LZ4 implementation by Yann Collet. Benchmark Results(PATCH v3) Compiler: Linaro ARM gcc 4.6.2 1. ARMv7, 1.5GHz based board Kernel: linux 3.4 Uncompressed Kernel Size: 14MB Compressed Size Decompression Speed LZO 6.7MB 20.1MB/s, 25.2MB/s(UA) LZ4 7.3MB 29.1MB/s, 45.6MB/s(UA) 2. ARMv7, 1.7GHz based board Kernel: linux 3.7 Uncompressed Kernel Size: 14MB Compressed Size Decompression Speed LZO 6.0MB 34.1MB/s, 52.2MB/s(UA) LZ4 6.5MB 86.7MB/s - UA: Unaligned memory Access support - Latest patch set for LZO applied This patch set is for adding support for LZ4-compressed Kernel. LZ4 is a very fast lossless compression algorithm and it also features an extremely fast decoder [1]. But we have five of decompressors already and one question which does arise, however, is that of where do we stop adding new ones? This issue had been discussed and came to the conclusion [2]. Russell King said that we should have: - one decompressor which is the fastest - one decompressor for the highest compression ratio - one popular decompressor (eg conventional gzip) If we have a replacement one for one of these, then it should do exactly that: replace it. The benchmark shows that an 8% increase in image size vs a 66% increase in decompression speed compared to LZO(which has been known as the fastest decompressor in the Kernel). Therefore the "fast but may not be small" compression title has clearly been taken by LZ4 [3]. [1] http://code.google.com/p/lz4/ [2] http://thread.gmane.org/gmane.linux.kbuild.devel/9157 [3] http://thread.gmane.org/gmane.linux.kbuild.devel/9347 LZ4 homepage: http://fastcompression.blogspot.com/p/lz4.html LZ4 source repository: http://code.google.com/p/lz4/ Signed-off-by: Kyungsik Lee <kyungsik.lee@lge.com> Signed-off-by: Yann Collet <yann.collet.73@gmail.com> Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/common/decompress.c')
-rw-r--r--xen/common/decompress.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/xen/common/decompress.c b/xen/common/decompress.c
index 1098481922..5f86af9cbe 100644
--- a/xen/common/decompress.c
+++ b/xen/common/decompress.c
@@ -29,5 +29,8 @@ int __init decompress(void *inbuf, unsigned int len, void *outbuf)
if ( len >= 5 && !memcmp(inbuf, "\x89LZO", 5) )
return unlzo(inbuf, len, NULL, NULL, outbuf, NULL, error);
+ if ( len >= 2 && !memcmp(inbuf, "\x02\x21", 2) )
+ return unlz4(inbuf, len, NULL, NULL, outbuf, NULL, error);
+
return 1;
}