public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] compressed in-memory swapping take4
@ 2009-03-29  3:43 Nitin Gupta
  2009-03-29  3:46 ` [PATCH 1/3] xvmalloc memory allocator Nitin Gupta
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Nitin Gupta @ 2009-03-29  3:43 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Christoph Lameter, Pekka Enberg, Ed Tomlinson, linux-mm-cc,
	linux-kernel@vger.kernel.org

Hi,

Project home: http://compcache.googlecode.com

It allows creating a RAM based block device which acts as swap disk.
Pages swapped to this device are compressed and stored in memory itself.
This is a big win over swapping to slow hard-disk which are typically used
as swap disk. For flash, these suffer from wear-leveling issues when used
as swap disk - so again its helpful. For swapless systems, it allows more
apps to run.

* Changelog: take4 vs take3
xvmalloc changes:
  - Fixed regression in take3 that caused ramzswap write failures.
    This happened due to error in find_block() where we did not do
    explicit cast to 'unsigned long' when checking for bits set in
    bitmap. Now changed it to use kernel build-in test_bit().
  - Fix divide by zero error in proc read function.
ramzswap changes:
  - Forward write requests to backing swap device if allocation for
    compressed page fails.
  - Code cleanups.

(Please also see testing notes below).

* Changelog: take3 vs take2
xvmalloc changes:
  - Use kernel defined macros and constants in xvmalloc and remove
    equivalent defines for ALIGN, roundup etc.
  - Use kernel bitops (set_bit, clear_bit)
  - Moved it to drivers/block since its not clear if it has any other
    user.
ramzswap changes:
  - All instances of compcache renamed to ramzswap.
    Also renamed module to ramzswap
  - Renamed "backing_dev" parameter to "backing_swap"
  - Documentation changes to reflect above changes.
  - Remove "table index" from object header (4 bytes). This will be
    needed when memory defragmentation is implemented. So, avoid this
    (small) overhead for now.

* Changelog: take2 vs initial revision:
xvmalloc changes:
  - Use Linux kernel coding style for xvmalloc
  - Collapse all individual flag test/set/get to generic {test_set_get}_flag
  - Added BLOCK_NEXT() macro to reach next contiguous block
  - Other minor cleanups - no functional changes
compcache block device code:
  - compcache core changes due to change in xvmalloc interface names

* Testing notes:
  - Multiple cycles of 'scan' benchmark available at:
http://linux-mm.org/PageReplacementTesting
It does scans of anonymous mapped memory, both cyclic and use once.

Config:
Arch: x86 and x64
CPUs: 1/2, RAM: 512MB
backing swap: 768MB, ramzswap memlimit: 76MB (15% of RAM).

Continuously run 'scan' till it triggers 200K R/W operations on ramzswap.
Any incompressible pages were correctly forwarded to backing swap device.
cmd: ./scan 450 20 # scan over 450MB, 20 times.

  - Links to more performance numbers, use cases can be found at:
http://lkml.org/lkml/2009/3/17/116

Thanks to Ed Tomlinson for reporting bug in 'take3' patches
and to reviewers of previous versions.

Thanks,
Nitin


^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH 0/3] compcache: in-memory compressed swapping v4
@ 2009-09-22  4:56 Nitin Gupta
  2009-09-22  4:56 ` [PATCH 1/3] xvmalloc memory allocator Nitin Gupta
  0 siblings, 1 reply; 9+ messages in thread
From: Nitin Gupta @ 2009-09-22  4:56 UTC (permalink / raw)
  To: Greg KH
  Cc: Andrew Morton, Hugh Dickins, Pekka Enberg, Marcin Slusarz,
	Ed Tomlinson, linux-kernel, linux-mm, linux-mm-cc

Project home: http://compcache.googlecode.com/

* Changelog: v4 vs v3
 - Remove swap notify callback and related bits. This make ramzswap
   contained entirely within drivers/staging/.
 - Above changes can cause ramzswap to work poorly since it cannot
   cleanup stale data from memory unless overwritten by some other data.
   (this will be fixed when swap notifer patches are accepted)
 - Some cleanups suggested by Marcin.

* Changelog: v3 vs v2
 - All cleanups as suggested by Pekka.
 - Move to staging (drivers/block/ramzswap/ -> drivers/staging/ramzswap/).
 - Remove swap discard hooks -- swap notify support makes these redundant.
 - Unify duplicate code between init_device() fail path and reset_device().
 - Fix zero-page accounting.
 - Do not accept backing swap with bad pages.

* Changelog: v2 vs initial revision
 - Use 'struct page' instead of 32-bit PFNs in ramzswap driver and xvmalloc.
   This is to make these 64-bit safe.
 - xvmalloc is no longer a separate module and does not export any symbols.
   Its compiled directly with ramzswap block driver. This is to avoid any
   last bit of confusion with any other allocator.
 - set_swap_free_notify() now accepts block_device as parameter instead of
   swp_entry_t (interface cleanup).
 - Fix: Make sure ramzswap disksize matches usable pages in backing swap file.
   This caused initialization error in case backing swap file had intra-page
   fragmentation.

It creates RAM based block devices which can be used (only) as swap disks.
Pages swapped to these disks are compressed and stored in memory itself. This
is a big win over swapping to slow hard-disk which are typically used as swap
disk. For flash, these suffer from wear-leveling issues when used as swap disk
- so again its helpful. For swapless systems, it allows more apps to run for a
given amount of memory.

It can create multiple ramzswap devices (/dev/ramzswapX, X = 0, 1, 2, ...).
Each of these devices can have separate backing swap (file or disk partition)
which is used when incompressible page is found or memory limit for device is
reached.

A separate userspace utility called rzscontrol is used to manage individual
ramzswap devices.

* Testing notes

Tested on x86, x64, ARM
ARM:
 - Cortex-A8 (Beagleboard)
 - ARM11 (Android G1)
 - OMAP2420 (Nokia N810)

* Performance

All performance numbers/plots can be found at:
http://code.google.com/p/compcache/wiki/Performance

Below is a summary of this data:

General:
 - Swap R/W times are reduced from milliseconds (in case of hard disks)
down to microseconds.

Positive cases:
 - Shows 33% improvement in 'scan' benchmark which allocates given amount
of memory and linearly reads/writes to this region. This benchmark also
exposes bottlenecks in ramzswap code (global mutex) due to which this gain
is so small.
 - On Linux thin clients, it gives the effect of nearly doubling the amount of
memory.

Negative cases:
Any workload that has active working set w.r.t. filesystem cache that is
nearly equal to amount of RAM while has minimal anonymous memory requirement,
is expected to suffer maximum loss in performance with ramzswap enabled.

Iozone filesystem benchmark can simulate exactly this kind of workload.
As expected, this test shows performance loss of ~25% with ramzswap.

 drivers/staging/Kconfig                   |    2 +
 drivers/staging/Makefile                  |    1 +
 drivers/staging/ramzswap/Kconfig          |   21 +
 drivers/staging/ramzswap/Makefile         |    3 +
 drivers/staging/ramzswap/ramzswap.txt     |   51 +
 drivers/staging/ramzswap/ramzswap_drv.c   | 1462 +++++++++++++++++++++++++++++
 drivers/staging/ramzswap/ramzswap_drv.h   |  173 ++++
 drivers/staging/ramzswap/ramzswap_ioctl.h |   50 +
 drivers/staging/ramzswap/xvmalloc.c       |  533 +++++++++++
 drivers/staging/ramzswap/xvmalloc.h       |   30 +
 drivers/staging/ramzswap/xvmalloc_int.h   |   86 ++
 include/linux/swap.h                      |    5 +
 mm/swapfile.c                             |   34 +
 13 files changed, 2451 insertions(+), 0 deletions(-)

^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH 0/3] compressed in-memory swapping take5
@ 2009-03-30 14:48 Nitin Gupta
  2009-03-30 14:50 ` [PATCH 1/3] xvmalloc memory allocator Nitin Gupta
  0 siblings, 1 reply; 9+ messages in thread
From: Nitin Gupta @ 2009-03-30 14:48 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Pekka Enberg, Christoph Lameter, Ed Tomlinson, linux-mm-cc,
	linux-kernel@vger.kernel.org

Hi,

Project home: http://compcache.googlecode.com

It allows creating a RAM based block device which acts as swap disk.
Pages swapped to this device are compressed and stored in memory itself.
This is a big win over swapping to slow hard-disk which are typically used
as swap disk. For flash, these suffer from wear-leveling issues when used
as swap disk - so again its helpful. For swapless systems, it allows more
apps to run.

* Changelog: take5 vs take4
xvmalloc changes:
  - Use kzalloc() instead of kmalloc() + memset().
  - Remove redundant initialization of pool freelists to 0.

* Changelog: take4 vs take3
xvmalloc changes:
  - Fixed regression in take3 that caused ramzswap write failures.
    This happened due to error in find_block() where we did not do
    explicit cast to 'unsigned long' when checking for bits set in
    bitmap. Now changed it to use kernel build-in test_bit().
  - Fix divide by zero error in proc read function.
ramzswap changes:
  - Forward write requests to backing swap device if allocation for
    compressed page fails.
  - Code cleanups.

* Changelog: take3 vs take2
xvmalloc changes:
  - Use kernel defined macros and constants in xvmalloc and remove
    equivalent defines for ALIGN, roundup etc.
  - Use kernel bitops (set_bit, clear_bit)
  - Moved it to drivers/block since its not clear if it has any other
    user.
ramzswap changes:
  - All instances of compcache renamed to ramzswap.
    Also renamed module to ramzswap
  - Renamed "backing_dev" parameter to "backing_swap"
  - Documentation changes to reflect above changes.
  - Remove "table index" from object header (4 bytes). This will be
    needed when memory defragmentation is implemented. So, avoid this
    (small) overhead for now.

* Changelog: take2 vs initial revision:
xvmalloc changes:
  - Use Linux kernel coding style for xvmalloc
  - Collapse all individual flag test/set/get to generic {test_set_get}_flag
  - Added BLOCK_NEXT() macro to reach next contiguous block
  - Other minor cleanups - no functional changes
compcache block device code:
  - compcache core changes due to change in xvmalloc interface names

* Testing notes:
  - Multiple cycles of 'scan' benchmark available at:
http://linux-mm.org/PageReplacementTesting
It does scans of anonymous mapped memory, both cyclic and use once.

Config:
Arch: x86 and x64
CPUs: 1/2, RAM: 512MB
backing swap: 768MB, ramzswap memlimit: 76MB (15% of RAM).

Continuously run 'scan' till it triggers 200K R/W operations on ramzswap.
Any incompressible pages were correctly forwarded to backing swap device.
cmd: ./scan 450 20 # scan over 450MB, 20 times.

  - Links to more performance numbers, use cases can be found at:
http://lkml.org/lkml/2009/3/17/116

Thanks to Ed Tomlinson for reporting bug in 'take3' patches
and to all the reviewers.

Thanks,
Nitin


^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH 0/3] compressed in-memory swapping take3
@ 2009-03-24 19:01 Nitin Gupta
  2009-03-24 19:11 ` [PATCH 1/3] xvmalloc memory allocator Nitin Gupta
  0 siblings, 1 reply; 9+ messages in thread
From: Nitin Gupta @ 2009-03-24 19:01 UTC (permalink / raw)
  To: Christoph Lameter, Andrew Morton, Pekka Enberg
  Cc: linux-kernel@vger.kernel.org

Hi,

Project home: http://code.google.com/p/compcache/

It allows creating a RAM based block device which acts as swap disk.
Pages swapped to this device are compressed and stored in memory itself.
This is a big win over swapping to slow hard-disk which are typically used
as swap disk. For flash, these suffer from wear-leveling issues when used
as swap disk - so again its helpful. For swapless systems, it allows more
apps to run.


* Changelog: take3 vs take2
xvmalloc changes:
  - Use kernel defined macros and constants in xvmalloc and remove
    equivalent defines for ALIGN, roundup etc.
  - Use kernel bitops (set_bit, clear_bit)
  - Moved it to drivers/block since its not clear if it has any other
    user.
ramzswap changes:
  - All instances of compcache renamed to ramzswap.
    Also renamed module to ramzswap
  - Renamed "backing_dev" parameter to "backing_swap"
  - Documentation changes to reflect above changes.
  - Remove "table index" from object header (4 bytes). This will be
    needed when memory defragmentation is implemented. So, avoid this
    (small) overhead for now.


* Changelog: take2 vs initial revision:
xvmalloc changes:
  - Use Linux kernel coding style for xvmalloc
  - Collapse all individual flag test/set/get to generic {test_set_get}_flag
  - Added BLOCK_NEXT() macro to reach next contiguous block
  - Other minor cleanups - no functional changes
compcache block device code:
  - compcache core changes due to change in xvmalloc interface names


Links to performance numbers, use cases can be found in original thread:
http://lkml.org/lkml/2009/3/17/116

Thanks to Christoph, Pekka and Andrew for feedback on previous revisions.

Thanks,
Nitin

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

end of thread, other threads:[~2009-09-22  4:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-29  3:43 [PATCH 0/3] compressed in-memory swapping take4 Nitin Gupta
2009-03-29  3:46 ` [PATCH 1/3] xvmalloc memory allocator Nitin Gupta
2009-03-29 10:39   ` Marcin Slusarz
2009-03-29 11:23     ` Nitin Gupta
2009-03-29  3:51 ` [PATCH 2/3] ramzswap virtual block device Nitin Gupta
2009-03-29  3:53 ` [PATCH 3/3] ramzswap documentation Nitin Gupta
  -- strict thread matches above, loose matches on Subject: below --
2009-09-22  4:56 [PATCH 0/3] compcache: in-memory compressed swapping v4 Nitin Gupta
2009-09-22  4:56 ` [PATCH 1/3] xvmalloc memory allocator Nitin Gupta
2009-03-30 14:48 [PATCH 0/3] compressed in-memory swapping take5 Nitin Gupta
2009-03-30 14:50 ` [PATCH 1/3] xvmalloc memory allocator Nitin Gupta
2009-03-24 19:01 [PATCH 0/3] compressed in-memory swapping take3 Nitin Gupta
2009-03-24 19:11 ` [PATCH 1/3] xvmalloc memory allocator Nitin Gupta

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