<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-dev/drivers/staging/ramzswap, branch master</title>
<subtitle>Linux kernel development work - see feature branches</subtitle>
<id>https://git.zx2c4.com/linux-dev/atom/drivers/staging/ramzswap?h=master</id>
<link rel='self' href='https://git.zx2c4.com/linux-dev/atom/drivers/staging/ramzswap?h=master'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/'/>
<updated>2010-06-18T19:46:42Z</updated>
<entry>
<title>Staging: Rename ramzswap files to zram</title>
<updated>2010-06-18T19:46:42Z</updated>
<author>
<name>Nitin Gupta</name>
<email>ngupta@vflare.org</email>
</author>
<published>2010-06-01T08:01:24Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=16a4bfb9e9dfefbd28ee170fa3e259bc88d81eb5'/>
<id>urn:sha1:16a4bfb9e9dfefbd28ee170fa3e259bc88d81eb5</id>
<content type='text'>
Related changes:
 - Modify revelant Kconfig and Makefile accordingly.
 - Change include filenames in code.
 - Remove dependency on CONFIG_SWAP in Kconfig as zram usage
is no longer limited to swap disks.

Signed-off-by: Nitin Gupta &lt;ngupta@vflare.org&gt;
Acked-by: Pekka Enberg &lt;penberg@cs.helsinki.fi&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
<entry>
<title>Staging: ramzswap: Support generic I/O requests</title>
<updated>2010-06-18T19:45:40Z</updated>
<author>
<name>Nitin Gupta</name>
<email>ngupta@vflare.org</email>
</author>
<published>2010-06-01T08:01:23Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=a1dd52afa94238d361d70502b219409ea115e235'/>
<id>urn:sha1:a1dd52afa94238d361d70502b219409ea115e235</id>
<content type='text'>
Currently, ramzwap devices (/dev/ramzswapX) can only
be used as swap disks since it was hard-coded to consider
only the first request in bio vector.

Now, we iterate over all the segments in an incoming
bio which allows us to handle all kinds of I/O requests.

ramzswap devices can still handle PAGE_SIZE aligned and
multiple of PAGE_SIZE sized I/O requests only. To ensure
that we get always get such requests only, we set following
request_queue attributes to PAGE_SIZE:
 - physical_block_size
 - logical_block_size
 - io_min
 - io_opt

Note: physical and logical block sizes were already set
equal to PAGE_SIZE and that seems to be sufficient to get
PAGE_SIZE aligned I/O.

Since we are no longer limited to handling swap requests
only, the next few patches rename ramzswap to zram. So,
the devices will then be called /dev/zram{0, 1, 2, ...}

Usage/Examples:
 1) Use as /tmp storage
 - mkfs.ext4 /dev/zram0
 - mount /dev/zram0 /tmp

 2) Use as swap:
 - mkswap /dev/zram0
 - swapon /dev/zram0 -p 10 # give highest priority to zram0

Performance:

 - I/O benchamark done with 'dd' command. Details can be
found here:
http://code.google.com/p/compcache/wiki/zramperf
Summary:
 - Maximum read speed (approx):
   - ram disk: 1200 MB/sec
   - zram disk: 600 MB/sec
 - Maximum write speed (approx):
   - ram disk: 500 MB/sec
   - zram disk: 160 MB/sec

Issues:

 - Double caching: We can potentially waste memory by having
two copies of a page -- one in page cache (uncompress) and
second in the device memory (compressed). However, during
reclaim, clean page cache pages are quickly freed, so this
does not seem to be a big problem.

 - Stale data: Not all filesystems support issuing 'discard'
requests to underlying block devices. So, if such filesystems
are used over zram devices, we can accumulate lot of stale
data in memory. Even for filesystems to do support discard
(example, ext4), we need to see how effective it is.

 - Scalability: There is only one (per-device) de/compression
buffer stats. This can lead to significant contention, especially
when used for generic (non-swap) purposes.

Signed-off-by: Nitin Gupta &lt;ngupta@vflare.org&gt;
Acked-by: Pekka Enberg &lt;penberg@cs.helsinki.fi&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
<entry>
<title>Staging: ramzswap: Handler for swap slot free callback</title>
<updated>2010-05-18T22:07:52Z</updated>
<author>
<name>Nitin Gupta</name>
<email>ngupta@vflare.org</email>
</author>
<published>2010-05-17T05:32:44Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=107c161b7ddeeb7da43509cc6b29211885ccd9af'/>
<id>urn:sha1:107c161b7ddeeb7da43509cc6b29211885ccd9af</id>
<content type='text'>
Install handler for swap_slot_free_notify callback which is called
when a swap slot is no longer used. This handler immediately frees
memory allocated corresponding to the given swap slot.

Signed-off-by: Nitin Gupta &lt;ngupta@vflare.org&gt;
Acked-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Acked-by: Nigel Cunningham &lt;nigel@tuxonice.net&gt;
Acked-by: Pekka Enberg &lt;penberg@cs.helsinki.fi&gt;
Reviewed-by: Minchan Kim &lt;minchan.kim@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
<entry>
<title>Staging: ramzswap: Remove backing swap support</title>
<updated>2010-05-14T20:25:28Z</updated>
<author>
<name>Nitin Gupta</name>
<email>ngupta@vflare.org</email>
</author>
<published>2010-05-13T08:54:21Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=97a0638218fc504d645c45ff03256dc4520efa72'/>
<id>urn:sha1:97a0638218fc504d645c45ff03256dc4520efa72</id>
<content type='text'>
Currently, each ramzswap device can be assigned
a separate 'backing swap' file/partition. The ramzswap
driver forwards swap I/O requests to this backing swap
whenever an incompressible page is found.

This feature adds nearly 700 lines of code and it
also duplicates much of the swapon() functionality
(for example, finding swap extents and so on). Removing
this code makes the driver much simpler and should
help its transition from staging to stable drivers
area (drivers/block/).

Similar functionality may be implemented if we can
implement migrating pages across swap devices but the
details have not yet been worked out.

Support for _partitions_ as backing swap could be
retained as it requires a few lines of code only.
This part can be re-introduced later if above swap
migration method turns out to be infeasible.

More cleanups and code comments will be added soon.

Signed-off-by: Nitin Gupta &lt;ngupta@vflare.org&gt;
Acked-by: Pekka Enberg &lt;penberg@cs.helsinki.fi&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;
</content>
</entry>
<entry>
<title>include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h</title>
<updated>2010-03-30T13:02:32Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2010-03-24T08:04:11Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=5a0e3ad6af8660be21ca98a971cd00f331318c05'/>
<id>urn:sha1:5a0e3ad6af8660be21ca98a971cd00f331318c05</id>
<content type='text'>
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files.  percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -&gt; slab.h dependency is about to be removed.  Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability.  As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

  http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
  only the necessary includes are there.  ie. if only gfp is used,
  gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
  blocks and try to put the new include such that its order conforms
  to its surrounding.  It's put in the include block which contains
  core kernel includes, in the same order that the rest are ordered -
  alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
  doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
  because the file doesn't have fitting include block), it prints out
  an error message indicating which .h file needs to be added to the
  file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
   over 4000 files, deleting around 700 includes and adding ~480 gfp.h
   and ~3000 slab.h inclusions.  The script emitted errors for ~400
   files.

2. Each error was manually checked.  Some didn't need the inclusion,
   some needed manual addition while adding it to implementation .h or
   embedding .c file was more appropriate for others.  This step added
   inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
   from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
   e.g. lib/decompress_*.c used malloc/free() wrappers around slab
   APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
   editing them as sprinkling gfp.h and slab.h inclusions around .h
   files could easily lead to inclusion dependency hell.  Most gfp.h
   inclusion directives were ignored as stuff from gfp.h was usually
   wildly available and often used in preprocessor macros.  Each
   slab.h inclusion directive was examined and added manually as
   necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
   were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
   distributed build env didn't work with gcov compiles) and a few
   more options had to be turned off depending on archs to make things
   build (like ipr on powerpc/64 which failed due to missing writeq).

   * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
   * powerpc and powerpc64 SMP allmodconfig
   * sparc and sparc64 SMP allmodconfig
   * ia64 SMP allmodconfig
   * s390 SMP allmodconfig
   * alpha SMP allmodconfig
   * um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
   a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Guess-its-ok-by: Christoph Lameter &lt;cl@linux-foundation.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Lee Schermerhorn &lt;Lee.Schermerhorn@hp.com&gt;
</content>
</entry>
<entry>
<title>Staging: ramzswap: Update copyright notice</title>
<updated>2010-03-04T00:42:53Z</updated>
<author>
<name>Nitin Gupta</name>
<email>ngupta@vflare.org</email>
</author>
<published>2010-01-28T15:51:35Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=1130ebbaae8ed0dcf8be707449601f8d7dbb7538'/>
<id>urn:sha1:1130ebbaae8ed0dcf8be707449601f8d7dbb7538</id>
<content type='text'>
Update copyright notice.

Signed-off-by: Nitin Gupta &lt;ngupta@vflare.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>Staging: ramzswap: Handle case for invalid backing swap</title>
<updated>2010-03-04T00:42:53Z</updated>
<author>
<name>Nitin Gupta</name>
<email>ngupta@vflare.org</email>
</author>
<published>2010-01-28T15:49:59Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=c25d75a234df36446dc0d9bb3365ab8b83374d50'/>
<id>urn:sha1:c25d75a234df36446dc0d9bb3365ab8b83374d50</id>
<content type='text'>
Currently, we crash (issue BUG_ON) if backing swap
disk size is zero. This can happen is user specified
an extended partition or simply a bad disk as backing
swap. A crash is really an unpleasant surprise to user
for such trivial problems.

Now, we check for this condition and simply fail device
initialization if this is the case.

Additional cleanups:
 * use static for all functions
 * remove extra newline between functions
 * memset backing_swap_name to NULL on device reset

Signed-off-by: Nitin Gupta &lt;ngupta@vflare.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>Staging: ramzswap: Remove redundant check for zero page</title>
<updated>2010-03-04T00:42:53Z</updated>
<author>
<name>Nitin Gupta</name>
<email>ngupta@vflare.org</email>
</author>
<published>2010-01-28T15:43:41Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=2e882281742f7e483e751bbbaf6c0946b5f8513f'/>
<id>urn:sha1:2e882281742f7e483e751bbbaf6c0946b5f8513f</id>
<content type='text'>
ramzswap_free_page() already handles the case for zero filled
pages. So, remove redundant logic for the same in ramzswap_write().

Signed-off-by: Nitin Gupta &lt;ngupta@vflare.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>Staging: ramzswap: Return proper error code on device create failure</title>
<updated>2010-03-04T00:42:53Z</updated>
<author>
<name>Nitin Gupta</name>
<email>ngupta@vflare.org</email>
</author>
<published>2010-01-28T15:43:40Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=de1a21a0f1f614dac0d8cacc13f41e32a15bba98'/>
<id>urn:sha1:de1a21a0f1f614dac0d8cacc13f41e32a15bba98</id>
<content type='text'>
Currently, we return 0 if create_device() fails and 1 otherwise.
Now, proper error code is returned from create_device() and the
same is propagated as module error code from ramzswap_init().

Also added some cleanups for ramzswap_init(), improving function
structure.

Signed-off-by: Nitin Gupta &lt;ngupta@vflare.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>Staging: ramzswap: Set block size to PAGE_SIZE</title>
<updated>2010-03-04T00:42:53Z</updated>
<author>
<name>Nitin Gupta</name>
<email>ngupta@vflare.org</email>
</author>
<published>2010-01-28T15:43:39Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=5d83d5a0b5ee332b724978d657c0af17f14e807e'/>
<id>urn:sha1:5d83d5a0b5ee332b724978d657c0af17f14e807e</id>
<content type='text'>
ramzswap block size needs to be set equal to PAGE_SIZE to
avoid receiving any unaligned block I/O requests (happens
due to readahead logic during swapon). These unaligned
accesses produce unnecessary I/O errors, scaring users.

Signed-off-by: Nitin Gupta &lt;ngupta@vflare.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
</feed>
