summaryrefslogtreecommitdiffstats
path: root/drivers/staging/ramzswap
Commit message (Collapse)AuthorAgeFilesLines
* Staging: ramzswap: Update copyright noticeNitin Gupta2010-03-036-6/+6
| | | | | | | | Update copyright notice. Signed-off-by: Nitin Gupta <ngupta@vflare.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: ramzswap: Handle case for invalid backing swapNitin Gupta2010-03-031-5/+11
| | | | | | | | | | | | | | | | | | | | 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 <ngupta@vflare.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: ramzswap: Remove redundant check for zero pageNitin Gupta2010-03-031-10/+5
| | | | | | | | | 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 <ngupta@vflare.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: ramzswap: Return proper error code on device create failureNitin Gupta2010-03-031-16/+28
| | | | | | | | | | | | | 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 <ngupta@vflare.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: ramzswap: Set block size to PAGE_SIZENitin Gupta2010-03-031-0/+4
| | | | | | | | | | | 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 <ngupta@vflare.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: ramzswap: Flush block device before resetNitin Gupta2010-03-031-3/+8
| | | | | | | | | Make sure we flush block device before freeing all metadata during reset ioctl. Signed-off-by: Nitin Gupta <ngupta@vflar.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: ramzswap: Use lock for 64-bit statsNitin Gupta2010-03-033-38/+80
| | | | | | | | | | | | | | | | | 64-bit stats corruption was observed when ramzswap was used on SMP systems. To prevent this, use separate spinlock to protect these stats. Also, replace stat_*() with rzs_stat*() to avoid possible conflict with core kernel code. Eventually, these will be converted to per-cpu counters if this driver finds use on large scale systems and this locking is found to affect scalability. Signed-off-by: Nitin Gupta <ngupta@vflare.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: ramzswap: Free memory when create_device is failedMinchan Kim2010-03-031-8/+13
| | | | | | | | | | | | If create_device is failed, it can't free gendisk and request_queue of preceding devices. It cause memory leak. This patch fixes it. Signed-off-by: Minchan Kim <minchan.kim@gmail.com> Acked-by: Nitin Gupta <ngupta@vflare.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: ramzswap: Minor spelling fixesC yp2010-03-037-13/+13
| | | | | | | | | Also removed an extra semicolon. Signed-off-by: Cyp <cyp561@gmail.com> Cc: Nitin Gupta <ngupta@vflare.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: ramzswap: remove unused #include <linux/version.h>Huang Weiyi2010-03-031-1/+0
| | | | | | | | | Remove unused #include <linux/version.h>('s) in drivers/staging/ramzswap/ramzswap_drv.c Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: ramzswap: remove ARM specific d-cache hackNitin Gupta2009-12-232-26/+3
| | | | | | | | | | | | | | Remove d-cache hack in ramzswap driver that was needed to workaround a bug in ARM version of update_mmu_cache() which caused stale data in d-cache to be transferred to userspace. This bug was fixed by git commit: 787b2faadc4356b6c2c71feb42fb944fece9a12f This also brings down one entry in TODO file. Signed-off-by: Nitin Gupta <ngupta@vflare.org> Acked-by: Pekka Enberg <penberg@cs.helsinki.fi> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: ramzswap: add TODO fileNitin Gupta2009-12-111-0/+6
| | | | | | | | TODO file for ramzswap. Signed-off-by: Nitin Gupta <ngupta@vflare.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: ramzswap: documentationNitin Gupta2009-12-111-0/+51
| | | | | | | | | Short guide on how to setup and use ramzswap. Signed-off-by: Nitin Gupta <ngupta@vflare.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: virtual block device driver (ramzswap)Nitin Gupta2009-12-115-0/+1679
| | | | | | | | | | | | | | | | | Creates RAM based block devices (/dev/ramzswapX) which can be used (only) as swap disks. Pages swapped to these are compressed and stored in memory itself. The module is called ramzswap.ko. It depends on: - xvmalloc memory allocator (compiled with this driver) - lzo_compress.ko - lzo_decompress.ko See ramzswap.txt for usage details. Signed-off-by: Nitin Gupta <ngupta@vflare.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* Staging: xvmalloc memory allocatorNitin Gupta2009-12-113-0/+623
* Features: - Low metadata overhead (just 4 bytes per object) - O(1) Alloc/Free - except when we have to call system page allocator to get additional memory. - Very low fragmentation: In all tests, xvmalloc memory usage is within 12% of "Ideal". - Pool based allocator: Each pool can grow and shrink. - It maps pages only when required. So, it does not hog vmalloc area which is very small on 32-bit systems. SLUB allocator could not be used due to fragmentation issues: http://code.google.com/p/compcache/wiki/AllocatorsComparison Data here shows kmalloc using ~43% more memory than TLSF and xvMalloc is showed ~2% more space efficiency than TLSF (due to smaller metadata). Creating various kmem_caches can reduce space efficiency gap but still problem of being limited to low memory exists. Also, it depends on allocating higher order pages to reduce fragmentation - this is not acceptable for ramzswap as it is used under memory crunch (its a swap device!). SLOB allocator could not be used do to reasons mentioned here: http://lkml.org/lkml/2009/3/18/210 * Implementation: It uses two-level bitmap search to find free list containing block of correct size. This idea is taken from TLSF (Two-Level Segregate Fit) allocator and is well explained in its paper (see [Links] below). * Limitations: - Poor scalability: No per-cpu data structures (work in progress). [Links] 1. Details and Performance data: http://code.google.com/p/compcache/wiki/xvMalloc http://code.google.com/p/compcache/wiki/xvMallocPerformance 2. TLSF memory allocator: home: http://rtportal.upv.es/rtmalloc/ paper: http://rtportal.upv.es/rtmalloc/files/MRBC_2008.pdf Signed-off-by: Nitin Gupta <ngupta@vflare.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
OpenPOWER on IntegriCloud