Re: Reiser4 und LZO compression

2006-08-29 Thread Nigel Cunningham
Hi.

On Tue, 2006-08-29 at 03:23 -0500, David Masover wrote:
 Nigel Cunningham wrote:
  Hi.
  
  On Tue, 2006-08-29 at 06:05 +0200, Jan Engelhardt wrote:
  Hmm.  LZO is the best compression algorithm for the task as measured by
  the objectives of good compression effectiveness while still having 
  very
  low CPU usage (the best of those written and GPL'd, there is a slightly
  better one which is proprietary and uses more CPU, LZRW if I remember
  right.  The gzip code base uses too much CPU, though I think Edward 
  made
  I don't think that LZO beats LZF in both speed and compression ratio.
 
  LZF is also available under GPL (dual-licensed BSD) and was choosen in 
  favor
  of LZO for the next generation suspend-to-disk code of the Linux kernel.
 
  see: http://www.goof.com/pcg/marc/liblzf.html
  thanks for the info, we will compare them
  For Suspend2, we ended up converting the LZF support to a cryptoapi
  plugin. Is there any chance that you could use cryptoapi modules? We
  could then have a hope of sharing the support.
  I am throwing in gzip: would it be meaningful to use that instead? The 
  decoder (inflate.c) is already there.
 
  06:04 shanghai:~/liblzf-1.6  l configure*
  -rwxr-xr-x  1 jengelh users 154894 Mar  3  2005 configure
  -rwxr-xr-x  1 jengelh users  26810 Mar  3  2005 configure.bz2
  -rw-r--r--  1 jengelh users  30611 Aug 28 20:32 configure.gz-z9
  -rw-r--r--  1 jengelh users  30693 Aug 28 20:32 configure.gz-z6
  -rw-r--r--  1 jengelh users  53077 Aug 28 20:32 configure.lzf
  
  We used gzip when we first implemented compression support, and found it
  to be far too slow. Even with the fastest compression options, we were
  only getting a few megabytes per second. Perhaps I did something wrong
  in configuring it, but there's not that many things to get wrong!
 
 All that comes to mind is the speed/quality setting -- the number from 1 
 to 9.  Recently, I backed up someone's hard drive using -1, and I 
 believe I was still able to saturate... the _network_.  Definitely try 
 again if you haven't changed this, but I can't imagine I'm the first 
 persson to think of it.
 
  From what I remember, gzip -1 wasn't faster than the disk.  But at 
 least for (very) repetitive data, I was wrong:
 
 eve:~ sanity$ time bash -c 'dd if=/dev/zero of=test bs=10m count=10; sync'
 10+0 records in
 10+0 records out
 104857600 bytes transferred in 3.261990 secs (32145287 bytes/sec)
 
 real0m3.746s
 user0m0.005s
 sys 0m0.627s
 eve:~ sanity$ time bash -c 'dd if=/dev/zero bs=10m count=10 | gzip -v1  
 test; sync'
 10+0 records in
 10+0 records out
 104857600 bytes transferred in 2.404093 secs (43616282 bytes/sec)
   99.5%
 
 real0m2.558s
 user0m1.554s
 sys 0m0.680s
 eve:~ sanity$
 
 
 
 This was on OS X, but I think it's still valid -- this is a slightly 
 older Powerbook, with a 5400 RPM drive, 1.6 ghz G4.
 
 -1 is still worlds better than nothing.  The backup was over 15 gigs, 
 down to about 6 -- loads of repetitive data, I'm sure, but that's where 
 you win with compression anyway.

Wow. That's a lot better; I guess I did get something wrong in trying to
tune deflate. That was pre-cryptoapi though; looking at
cryptoapi/deflate.c, I don't see any way of controlling the compression
level. Am I missing anything?

 Well, you use cryptoapi anyway, so it should be easy to just let the 
 user pick a plugin, right?

Right. They can already pick deflate if they want to.

Regards,

Nigel



Re: Reiser4 und LZO compression

2006-08-29 Thread Nigel Cunningham
Hi.

On Tue, 2006-08-29 at 15:38 +0400, Edward Shishkin wrote:
 Nigel Cunningham wrote:
  Hi.
  
  On Tue, 2006-08-29 at 03:23 -0500, David Masover wrote:
  
 Nigel Cunningham wrote:
 
 Hi.
 
 On Tue, 2006-08-29 at 06:05 +0200, Jan Engelhardt wrote:
 
 Hmm.  LZO is the best compression algorithm for the task as measured 
 by
 the objectives of good compression effectiveness while still having 
 very
 low CPU usage (the best of those written and GPL'd, there is a 
 slightly
 better one which is proprietary and uses more CPU, LZRW if I remember
 right.  The gzip code base uses too much CPU, though I think Edward 
 made
 
 I don't think that LZO beats LZF in both speed and compression ratio.
 
 LZF is also available under GPL (dual-licensed BSD) and was choosen in 
 favor
 of LZO for the next generation suspend-to-disk code of the Linux 
 kernel.
 
 see: http://www.goof.com/pcg/marc/liblzf.html
 
 thanks for the info, we will compare them
 
 For Suspend2, we ended up converting the LZF support to a cryptoapi
 plugin. Is there any chance that you could use cryptoapi modules? We
 could then have a hope of sharing the support.
 
 I am throwing in gzip: would it be meaningful to use that instead? The 
 decoder (inflate.c) is already there.
 
 06:04 shanghai:~/liblzf-1.6  l configure*
 -rwxr-xr-x  1 jengelh users 154894 Mar  3  2005 configure
 -rwxr-xr-x  1 jengelh users  26810 Mar  3  2005 configure.bz2
 -rw-r--r--  1 jengelh users  30611 Aug 28 20:32 configure.gz-z9
 -rw-r--r--  1 jengelh users  30693 Aug 28 20:32 configure.gz-z6
 -rw-r--r--  1 jengelh users  53077 Aug 28 20:32 configure.lzf
 
 We used gzip when we first implemented compression support, and found it
 to be far too slow. Even with the fastest compression options, we were
 only getting a few megabytes per second. Perhaps I did something wrong
 in configuring it, but there's not that many things to get wrong!
 
 All that comes to mind is the speed/quality setting -- the number from 1 
 to 9.  Recently, I backed up someone's hard drive using -1, and I 
 believe I was still able to saturate... the _network_.  Definitely try 
 again if you haven't changed this, but I can't imagine I'm the first 
 persson to think of it.
 
  From what I remember, gzip -1 wasn't faster than the disk.  But at 
 least for (very) repetitive data, I was wrong:
 
 eve:~ sanity$ time bash -c 'dd if=/dev/zero of=test bs=10m count=10; sync'
 10+0 records in
 10+0 records out
 104857600 bytes transferred in 3.261990 secs (32145287 bytes/sec)
 
 real0m3.746s
 user0m0.005s
 sys 0m0.627s
 eve:~ sanity$ time bash -c 'dd if=/dev/zero bs=10m count=10 | gzip -v1  
 test; sync'
 10+0 records in
 10+0 records out
 104857600 bytes transferred in 2.404093 secs (43616282 bytes/sec)
   99.5%
 
 real0m2.558s
 user0m1.554s
 sys 0m0.680s
 eve:~ sanity$
 
 
 
 This was on OS X, but I think it's still valid -- this is a slightly 
 older Powerbook, with a 5400 RPM drive, 1.6 ghz G4.
 
 -1 is still worlds better than nothing.  The backup was over 15 gigs, 
 down to about 6 -- loads of repetitive data, I'm sure, but that's where 
 you win with compression anyway.
  
  
  Wow. That's a lot better; I guess I did get something wrong in trying to
  tune deflate. That was pre-cryptoapi though; looking at
  cryptoapi/deflate.c, I don't see any way of controlling the compression
  level. Am I missing anything?
  
 
 zlib is tunable, not cryptoapi's deflate.
 look at zlib_deflateInit2()

Ok; thanks. I wasn't mistaken then :)

Regards,

Nigel



Re: Reiser4 und LZO compression

2006-08-28 Thread Nigel Cunningham
Hi.

On Mon, 2006-08-28 at 22:15 +0400, Edward Shishkin wrote:
 Stefan Traby wrote:
  On Mon, Aug 28, 2006 at 10:06:46AM -0700, Hans Reiser wrote:
  
  
 Hmm.  LZO is the best compression algorithm for the task as measured by
 the objectives of good compression effectiveness while still having very
 low CPU usage (the best of those written and GPL'd, there is a slightly
 better one which is proprietary and uses more CPU, LZRW if I remember
 right.  The gzip code base uses too much CPU, though I think Edward made
  
  
  I don't think that LZO beats LZF in both speed and compression ratio.
  
  LZF is also available under GPL (dual-licensed BSD) and was choosen in favor
  of LZO for the next generation suspend-to-disk code of the Linux kernel.
  
  see: http://www.goof.com/pcg/marc/liblzf.html
  
 
 thanks for the info, we will compare them

For Suspend2, we ended up converting the LZF support to a cryptoapi
plugin. Is there any chance that you could use cryptoapi modules? We
could then have a hope of sharing the support.

Regards,

Nigel



Re: Reiser4 und LZO compression

2006-08-28 Thread Nigel Cunningham
Hi.

On Tue, 2006-08-29 at 06:05 +0200, Jan Engelhardt wrote:
  Hmm.  LZO is the best compression algorithm for the task as measured by
  the objectives of good compression effectiveness while still having very
  low CPU usage (the best of those written and GPL'd, there is a slightly
  better one which is proprietary and uses more CPU, LZRW if I remember
  right.  The gzip code base uses too much CPU, though I think Edward made
   
   I don't think that LZO beats LZF in both speed and compression ratio.
   
   LZF is also available under GPL (dual-licensed BSD) and was choosen in 
   favor
   of LZO for the next generation suspend-to-disk code of the Linux kernel.
   
   see: http://www.goof.com/pcg/marc/liblzf.html
  
  thanks for the info, we will compare them
 
 For Suspend2, we ended up converting the LZF support to a cryptoapi
 plugin. Is there any chance that you could use cryptoapi modules? We
 could then have a hope of sharing the support.
 
 I am throwing in gzip: would it be meaningful to use that instead? The 
 decoder (inflate.c) is already there.
 
 06:04 shanghai:~/liblzf-1.6  l configure*
 -rwxr-xr-x  1 jengelh users 154894 Mar  3  2005 configure
 -rwxr-xr-x  1 jengelh users  26810 Mar  3  2005 configure.bz2
 -rw-r--r--  1 jengelh users  30611 Aug 28 20:32 configure.gz-z9
 -rw-r--r--  1 jengelh users  30693 Aug 28 20:32 configure.gz-z6
 -rw-r--r--  1 jengelh users  53077 Aug 28 20:32 configure.lzf

We used gzip when we first implemented compression support, and found it
to be far too slow. Even with the fastest compression options, we were
only getting a few megabytes per second. Perhaps I did something wrong
in configuring it, but there's not that many things to get wrong!

In contrast, with LZF, we get very high throughput. My current laptop is
an 1.8MHz Turion with a 7200 RPM (PATA) drive. Without LZF compression,
my throughput in writing an image is the maximum the drive  interface
can manage - 38MB/s. With LZF, I get roughly that divided by compression
ratio achieved, so if the compression ratio is ~50%, as it generally is,
I'm reading and writing the image at 75-80MB/s. During this time, all
the computer is doing is compressing pages using LZF and submitting
bios, with the odd message being send to the userspace interface app via
netlink. I realise this is very different to the workload you'll be
doing, but hopefully the numbers are somewhat useful:

[EMAIL PROTECTED]:~$ cat /sys/power/suspend2/debug_info
Suspend2 debugging info:
- SUSPEND core   : 2.2.7.4
- Kernel Version : 2.6.18-rc4
- Compiler vers. : 4.1
- Attempt number : 1
- Parameters : 0 32785 0 0 0 0
- Overall expected compression percentage: 0.
- Compressor is 'lzf'.
  Compressed 820006912 bytes into 430426371 (47 percent compression).
- Swapwriter active.
  Swap available for image: 487964 pages.
- Filewriter inactive.
- I/O speed: Write 74 MB/s, Read 70 MB/s.
- Extra pages: 1913 used/2100.
[EMAIL PROTECTED]:~$

(Modify hibernate.conf to disable compression, suspend again...)

[EMAIL PROTECTED]:~$ cat /sys/power/suspend2/debug_info
Suspend2 debugging info:
- SUSPEND core   : 2.2.7.4
- Kernel Version : 2.6.18-rc4
- Compiler vers. : 4.1
- Attempt number : 2
- Parameters : 0 32785 0 0 0 0
- Overall expected compression percentage: 0.
- Swapwriter active.
  Swap available for image: 487964 pages.
- Filewriter inactive.
- I/O speed: Write 38 MB/s, Read 39 MB/s.
- Extra pages: 1907 used/2100.
[EMAIL PROTECTED]:~$

Oh, I also have a debugging mode where I can get Suspend2 to just
compress the pages but not actually write anything. If I do that, it
says it can do 80MB/s on my kernel image, so the disk is still the
bottleneck, it seems.

Hope this all helps (and isn't information overload!)

Nigel



Re: Reiser4 und LZO compression

2006-08-28 Thread Nigel Cunningham
Hi.

On Tue, 2006-08-29 at 13:59 +0900, Paul Mundt wrote:
 On Tue, Aug 29, 2006 at 07:48:25AM +1000, Nigel Cunningham wrote:
  For Suspend2, we ended up converting the LZF support to a cryptoapi
  plugin. Is there any chance that you could use cryptoapi modules? We
  could then have a hope of sharing the support.
  
 Using cryptoapi plugins for the compression methods is an interesting
 approach, there's a few other places in the kernel that could probably
 benefit from this as well, such as jffs2 (which at the moment rolls its
 own compression subsystem), and the out-of-tree page and swap cache
 compression work.
 
 Assuming you were wrapping in to LZF directly prior to the cryptoapi
 integration, do you happen to have before and after numbers to determine
 how heavyweight the rest of the cryptoapi overhead is? It would be
 interesting to profile this and consider migrating the in-tree users,
 rather than duplicating the compress/decompress routines all over the
 place.

I was, but I don't have numbers right now. I'm about to go out, but will
see if I can find them when I get back later. From memory, it wasn't a
huge change in terms of lines of code.

Regards,

Nigel