zram/zsmalloc promotion
Subsystems (6)
Minchan Kim
maintainerv6 cover zram/zsmalloc promotion
It's 5th trial of zram/zsmalloc promotion.
[patch 5, zram: promote zram from staging] explains why we need zram.
Main reason to block promotion is there was no review of zsmalloc part while Jens already acked zram part.
At that time, zsmalloc was used for zram, zcache and zswap so everybody wanted to make it general and at last, Mel reviewed it.
Most of review was related to zswap dumping mechanism which can pageout compressed page into swap in runtime and zswap gives up using zsmalloc and invented a new wheel, zbud. Other reviews were not major.
http://lkml.indiana.edu/hypermail/linux/kernel/1304.1/04334.html
Zcache don't use zsmalloc either so only zsmalloc user is zram now. So I think there is no concern any more.
Patch 1 adds new Kconfig for zram to use page table method instead of copy. Andrew suggested it.
Patch 2 adds lots of commnt for zsmalloc.
Patch 3 moves zsmalloc under driver/staging/zram because zram is only user for zram now.
Patch 4 makes unmap_kernel_range exportable function because zsmalloc have used map_vm_area which is already exported function but zsmalloc need to use unmap_kernel_range and it should be built with module.
Patch 5 moves zram from driver/staging to driver/blocks, finally.
It touches mm, staging, blocks so I am not sure who is right position maintainer so I will Cc Andrw, Jens and Greg.
This patch is based on next-20130813.
Thanks.
Minchan Kim (4):
zsmalloc: add Kconfig for enabling page table method
zsmalloc: move it under zram
mm: export unmap_kernel_range
zram: promote zram from staging
Nitin Cupta (1):
zsmalloc: add more comment
drivers/block/Kconfig | 2 + drivers/block/Makefile | 1 + drivers/block/zram/Kconfig | 37 + drivers/block/zram/Makefile | 3 + drivers/block/zram/zram.txt | 71 ++ drivers/block/zram/zram_drv.c | 987 +++++++++++++++++++++++++++ drivers/block/zram/zsmalloc.c | 1084 ++++++++++++++++++++++++++++++ drivers/staging/Kconfig | 4 - drivers/staging/Makefile | 2 - drivers/staging/zram/Kconfig | 25 - drivers/staging/zram/Makefile | 3 - drivers/staging/zram/zram.txt | 77 --- drivers/staging/zram/zram_drv.c | 984 --------------------------- drivers/staging/zram/zram_drv.h | 125 ---- drivers/staging/zsmalloc/Kconfig | 10 - drivers/staging/zsmalloc/Makefile | 3 - drivers/staging/zsmalloc/zsmalloc-main.c | 1063 ----------------------------- drivers/staging/zsmalloc/zsmalloc.h | 43 -- include/linux/zram.h | 123 ++++ include/linux/zsmalloc.h | 52 ++ mm/vmalloc.c | 1 + 21 files changed, 2361 insertions(+), 2339 deletions(-) create mode 100644 drivers/block/zram/Kconfig create mode 100644 drivers/block/zram/Makefile create mode 100644 drivers/block/zram/zram.txt create mode 100644 drivers/block/zram/zram_drv.c create mode 100644 drivers/block/zram/zsmalloc.c delete mode 100644 drivers/staging/zram/Kconfig delete mode 100644 drivers/staging/zram/Makefile delete mode 100644 drivers/staging/zram/zram.txt delete mode 100644 drivers/staging/zram/zram_drv.c delete mode 100644 drivers/staging/zram/zram_drv.h delete mode 100644 drivers/staging/zsmalloc/Kconfig delete mode 100644 drivers/staging/zsmalloc/Makefile delete mode 100644 drivers/staging/zsmalloc/zsmalloc-main.c delete mode 100644 drivers/staging/zsmalloc/zsmalloc.h create mode 100644 include/linux/zram.h create mode 100644 include/linux/zsmalloc.h
Signature · 7 lines
1.7.9.5 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Minchan Kim
maintainerPATCH v6 1/5 zsmalloc: add Kconfig for enabling page table method
Zsmalloc has two methods 1) copy-based and 2) pte based to access objects that span two pages.
You can see history why we supported two approach from [1].
But it was bad choice that adding hard coding to select arch which want to use pte based method because there are lots of SoC in an architecure and they can have different cache size, CPU speed and so on so it would be better to expose it to user as selectable Kconfig option like Andrew Morton suggested.
[1] https://lkml.org/lkml/2012/7/11/58
--- drivers/staging/zsmalloc/Kconfig | 13 +++++++++++++ drivers/staging/zsmalloc/zsmalloc-main.c | 19 ++++--------------- 2 files changed, 17 insertions(+), 15 deletions(-)
drivers/staging/zsmalloc/Kconfig +13 -0
@@ -8,3 +8,16 @@ config ZSMALLOC non-standard allocator interface where a handle, not a pointer, is returned by an alloc(). This handle must be mapped in order to access the allocated space. + +config PGTABLE_MAPPING + bool "Use page table mapping to access object in zsmalloc" + depends on ZSMALLOC + help + By default, zsmalloc uses a copy-based object mapping method to + access allocations that span two pages. However, if a particular + architecture (ex, ARM) performs VM mapping faster than copying, + then you should select this. This causes zsmalloc to use page table + mapping rather than copying for object mapping. + + You can check speed with zsmalloc benchmark[1]. + [1] https://github.com/spartacus06/zsmalloc
drivers/staging/zsmalloc/zsmalloc-main.c +4 -15
@@ -218,19 +218,8 @@ struct zs_pool {#define CLASS_IDX_MASK ((1 << CLASS_IDX_BITS) - 1)#define FULLNESS_MASK ((1 << FULLNESS_BITS) - 1) -/* -* By default, zsmalloc uses a copy-based object mapping method to access -* allocations that span two pages. However, if a particular architecture -* performs VM mapping faster than copying, then it should be added here -* so that USE_PGTABLE_MAPPING is defined. This causes zsmalloc to use -* page table mapping rather than copying for object mapping. -*/ -#if defined(CONFIG_ARM ) && !defined(MODULE ) -#define USE_PGTABLE_MAPPING -#endif -struct mapping_area { -#ifdef USE_PGTABLE_MAPPING +#ifdef CONFIG_PGTABLE_MAPPING struct vm_struct *vm;/* vm area for mapping object that span pages */ #else char *vm_buf;/* copy buffer for objects that span pages */
@@ -622,7 +611,7 @@ static struct page *find_get_zspage(struct size_class *class)return page; } -#ifdef USE_PGTABLE_MAPPING +#ifdef CONFIG_PGTABLE_MAPPING static inline int __zs_cpu_up (struct mapping_area *area) {/*
@@ -660,7 +649,7 @@ static inline void __zs_unmap_object(struct mapping_area *area, unmap_kernel_range(addr, PAGE_SIZE * 2); } -#else /* USE_PGTABLE_MAPPING */ +#else /* CONFIG_PGTABLE_MAPPING */ static inline int __zs_cpu_up (struct mapping_area *area) {
@@ -738,7 +727,7 @@ out: pagefault_enable(); } -#endif /* USE_PGTABLE_MAPPING */ +#endif /* CONFIG_PGTABLE_MAPPING */ static int zs_cpu_notifier (struct notifier_block *nb,unsigned long action,void *pcpu)
Signature · 7 lines
1.7.9.5 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Minchan Kim
maintainerPATCH v6 2/5 zsmalloc: add more comment
In reply to Minchan KimFrom: Nitin Cupta <[email protected]>
This patch adds lots of comments and it will help others to review and enhance.
--- drivers/staging/zsmalloc/zsmalloc-main.c | 66 +++++++++++++++++++++++++----- drivers/staging/zsmalloc/zsmalloc.h | 9 +++- 2 files changed, 64 insertions(+), 11 deletions(-)
drivers/staging/zsmalloc/zsmalloc-main.c +56 -10
@@ -10,16 +10,14 @@* Released under the terms of GNU General Public License Version 2.0 */ -/* -* This allocator is designed for use with zcache and zram. Thus, the -* allocator is supposed to work well under low memory conditions. In -* particular, it never attempts higher order page allocation which is -* very likely to fail under memory pressure. On the other hand, if we -* just use single (0-order) pages, it would suffer from very high -* fragmentation -- any object of size PAGE_SIZE/2 or larger would occupy -* an entire page. This was one of the major issues with its predecessor -* (xvmalloc). +* This allocator is designed for use with zram. Thus, the allocator is +* supposed to work well under low memory conditions. In particular, it +* never attempts higher order page allocation which is very likely to +* fail under memory pressure. On the other hand, if we just use single +* (0-order) pages, it would suffer from very high fragmentation -- +* any object of size PAGE_SIZE/2 or larger would occupy an entire page. +* This was one of the major issues with its predecessor (xvmalloc). * * To overcome these issues, zsmalloc allocates a bunch of 0-order pages * and links them together using various 'struct page' fields. These linked
@@ -27,6 +25,21 @@* page boundaries. The code refers to these linked pages as a single entity * called zspage. * +* For simplicity, zsmalloc can only allocate objects of size up to PAGE_SIZE +* since this satisfies the requirements of all its current users (in the +* worst case, page is incompressible and is thus stored "as-is" i.e. in +* uncompressed form). For allocation requests larger than this size, failure +* is returned (see zs_malloc). +* +* Additionally, zs_malloc() does not return a dereferenceable pointer. +* Instead, it returns an opaque handle (unsigned long) which encodes actual +* location of the allocated object. The reason for this indirection is that +* zsmalloc does not keep zspages permanently mapped since that would cause +* issues on 32-bit systems where the VA region for kernel space mappings +* is very small. So, before using the allocating memory, the object has to +* be mapped using zs_map_object() to get a usable pointer and subsequently +* unmapped using zs_unmap_object(). +* * Following is how we use various fields and flags of underlying * struct page(s) to form a zspage. *
@@ -98,7 +111,7 @@/* * Object location (<PFN>, <obj_idx>) is encoded as -* as single (void *) handle value. +* as single (unsigned long) handle value. * * Note that object index <obj_idx> is relative to system * page <PFN> it is stored in, so for each sub-page belonging
@@ -264,6 +277,13 @@ static void set_zspage_mapping(struct page *page, unsigned int class_idx, page->mapping = (struct address_space *)m; } +/* +* zsmalloc divides the pool into various size classes where each +* class maintains a list of zspages where each zspage is divided +* into equal sized chunks. Each allocation falls into one of these +* classes depending on its size. This function returns index of the +* size class which has chunk size big enough to hold the give size. +*/ static int get_size_class_index (int size) {int idx =0 ;
@@ -275,6 +295,13 @@ static int get_size_class_index(int size)return idx; } +/* +* For each size class, zspages are divided into different groups +* depending on how "full" they are. This was done so that we could +* easily find empty or nearly empty zspages when we try to shrink +* the pool (not yet implemented). This function returns fullness +* status of the given page. +*/ static enum fullness_group get_fullness_group (struct page *page) {int inuse, max_objects;
@@ -296,6 +323,12 @@ static enum fullness_group get_fullness_group(struct page *page)return fg; } +/* +* Each size class maintains various freelists and zspages are assigned +* to one of these freelists based on the number of live objects they +* have. This functions inserts the given zspage into the freelist +* identified by <class, fullness_group>. +*/ static void insert_zspage (struct page *page,struct size_class *class,enum fullness_group fullness) {
@@ -313,6 +346,10 @@ static void insert_zspage(struct page *page, struct size_class *class, *head = page; } +/* +* This function removes the given zspage from the freelist identified +* by <class, fullness_group>. +*/ static void remove_zspage (struct page *page,struct size_class *class,enum fullness_group fullness) {
@@ -334,6 +371,15 @@ static void remove_zspage(struct page *page, struct size_class *class,list_del_init (&page->lru); } +/* +* Each size class maintains zspages in different fullness groups depending +* on the number of live objects they contain. When allocating or freeing +* objects, the fullness status of the page can change, say, from ALMOST_FULL +* to ALMOST_EMPTY when freeing an object. This function checks if such +* a status change has occurred for the given page and accordingly moves the +* page from the freelist of the old fullness group to that of the new +* fullness group. +*/ static enum fullness_group fix_fullness_group (struct zs_pool *pool,struct page *page) {
drivers/staging/zsmalloc/zsmalloc.h +8 -1
@@ -18,12 +18,19 @@/* * zsmalloc mapping modes * -* NOTE: These only make a difference when a mapped object spans pages +* NOTE: These only make a difference when a mapped object spans pages. +* They also have no effect when PGTABLE_MAPPING is selected. */ enum zs_mapmode {ZS_MM_RW ,/* normal read-write mapping */ ZS_MM_RO ,/* read-only (no copy-out at unmap time) */ ZS_MM_WO /* write-only (no copy-in at map time) */ +/* +* NOTE: ZS_MM_WO should only be used for initializing new +* (uninitialized) allocations. Partial writes to already +* initialized allocations should use ZS_MM_RW to preserve the +* existing data. +*/ };struct zs_pool ;
Signature · 7 lines
1.7.9.5 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Minchan Kim
maintainerPATCH v6 3/5 zsmalloc: move it under zram
In reply to Minchan KimThis patch moves zsmalloc under zram directory because there isn't any other user any more.
Before that, description will explain why we have needed custom allocator.
Zsmalloc is a new slab-based memory allocator for storing compressed pages. It is designed for low fragmentation and high allocation success rate on large object, but <= PAGE_SIZE allocations.
zsmalloc differs from the kernel slab allocator in two primary ways to achieve these design goals.
zsmalloc never requires high order page allocations to back slabs, or "size classes" in zsmalloc terms. Instead it allows multiple single-order pages to be stitched together into a "zspage" which backs the slab. This allows for higher allocation success rate under memory pressure.
Also, zsmalloc allows objects to span page boundaries within the zspage. This allows for lower fragmentation than could be had with the kernel slab allocator for objects between PAGE_SIZE/2 and PAGE_SIZE. With the kernel slab allocator, if a page compresses to 60% of it original size, the memory savings gained through compression is lost in fragmentation because another object of the same size can't be stored in the leftover space.
This ability to span pages results in zsmalloc allocations not being directly addressable by the user. The user is given an non-dereferencable handle in response to an allocation request. That handle must be mapped, using zs_map_object(), which returns a pointer to the mapped region that can be used. The mapping is necessary since the object data may reside in two different noncontigious pages.
The zsmalloc fulfills the allocation needs for zram perfectly and there is no user any more so let's move it into zram/. (I and Nitin already discussed it).
NOTE:
This change prevent to build zram to module because zsmalloc uses unmap_kernel_range which isn't exported so we wanted to export it but it doesn't makse sense because zsmalloc was in staging. Upcoming patch will solve it.
https://lkml.org/lkml/2013/3/26/794
--- drivers/staging/Kconfig | 2 - drivers/staging/Makefile | 1 - drivers/staging/zram/Kconfig | 17 +- drivers/staging/zram/Makefile | 2 +- drivers/staging/zram/zram_drv.c | 5 + drivers/staging/zram/zram_drv.h | 3 +- drivers/staging/zram/zsmalloc.c | 1084 +++++++++++++++++++++++++++++ drivers/staging/zsmalloc/Kconfig | 23 - drivers/staging/zsmalloc/Makefile | 3 - drivers/staging/zsmalloc/zsmalloc-main.c | 1098 ------------------------------ drivers/staging/zsmalloc/zsmalloc.h | 50 -- include/linux/zsmalloc.h | 52 ++ 12 files changed, 1158 insertions(+), 1182 deletions(-) create mode 100644 drivers/staging/zram/zsmalloc.c delete mode 100644 drivers/staging/zsmalloc/Kconfig delete mode 100644 drivers/staging/zsmalloc/Makefile delete mode 100644 drivers/staging/zsmalloc/zsmalloc-main.c delete mode 100644 drivers/staging/zsmalloc/zsmalloc.h create mode 100644 include/linux/zsmalloc.h
drivers/staging/Kconfig +0 -2
@@ -72,8 +72,6 @@ source "drivers/staging/sep/Kconfig" source "drivers/staging/iio/Kconfig" -source "drivers/staging/zsmalloc/Kconfig" - source "drivers/staging/zram/Kconfig" source "drivers/staging/wlags49_h2/Kconfig"
drivers/staging/Makefile +0 -1
@@ -31,7 +31,6 @@ obj-$(CONFIG_VME_BUS) += vme/ obj-$(CONFIG_DX_SEP) += sep/ obj-$(CONFIG_IIO) += iio/ obj-$(CONFIG_ZRAM) += zram/ -obj-$(CONFIG_ZSMALLOC) += zsmalloc/ obj-$(CONFIG_WLAGS49_H2) += wlags49_h2/ obj-$(CONFIG_WLAGS49_H25) += wlags49_h25/ obj-$(CONFIG_FB_SM7XX) += sm7xxfb/
drivers/staging/zram/Kconfig +15 -2
@@ -1,6 +1,6 @@ config ZRAM - tristate "Compressed RAM block device support" - depends on BLOCK && SYSFS && ZSMALLOC + bool "Compressed RAM block device support" + depends on BLOCK && SYSFS select LZO_COMPRESS select LZO_DECOMPRESS default n
@@ -23,3 +23,16 @@ config ZRAM_DEBUG help This option adds additional debugging code to the compressed RAM block device driver. + +config PGTABLE_MAPPING + bool "Use page table mapping to access object in zsmalloc" + depends on ZRAM + help + By default, zsmalloc uses a copy-based object mapping method to + access allocations that span two pages. However, if a particular + architecture (ex, ARM) performs VM mapping faster than copying, + then you should select this. This causes zsmalloc to use page table + mapping rather than copying for object mapping. + + You can check speed with zsmalloc benchmark[1]. + [1] https://github.com/spartacus06/zsmalloc
drivers/staging/zram/Makefile +1 -1
@@ -1,3 +1,3 @@ zram-y := zram_drv.o -obj-$(CONFIG_ZRAM) += zram.o +obj-$(CONFIG_ZRAM) += zram.o zsmalloc.o
drivers/staging/zram/zram_drv.c +5 -0
@@ -909,6 +909,10 @@ static int __init zram_init(void) {int ret, dev_id; + ret =zs_init (); +if (ret) +return ret; +if (num_devices > max_num_devices) {pr_warn ("Invalid value for num_devices: %u\n" , num_devices);
@@ -947,6 +951,7 @@ free_devices: unregister:unregister_blkdev (zram_major,"zram" ); out: +zs_exit ();return ret; }
drivers/staging/zram/zram_drv.h +1 -2
@@ -17,8 +17,7 @@#include <linux/spinlock.h> #include <linux/mutex.h> - -#include "../zsmalloc/zsmalloc.h" +#include <linux/zsmalloc.h> /* * Some arbitrary value. This is just to catch
drivers/staging/zram/zsmalloc.c new file +1084 -0
1,084 lines not on this page · raw message
drivers/staging/zsmalloc/Kconfig deleted +0 -23
@@ -1,23 +0,0 @@ -config ZSMALLOC - bool "Memory allocator for compressed pages" - default n - help - zsmalloc is a slab-based memory allocator designed to store - compressed RAM pages. zsmalloc uses virtual memory mapping - in order to reduce fragmentation. However, this results in a - non-standard allocator interface where a handle, not a pointer, is - returned by an alloc(). This handle must be mapped in order to - access the allocated space. - -config PGTABLE_MAPPING - bool "Use page table mapping to access object in zsmalloc" - depends on ZSMALLOC - help - By default, zsmalloc uses a copy-based object mapping method to - access allocations that span two pages. However, if a particular - architecture (ex, ARM) performs VM mapping faster than copying, - then you should select this. This causes zsmalloc to use page table - mapping rather than copying for object mapping. - - You can check speed with zsmalloc benchmark[1]. - [1] https://github.com/spartacus06/zsmalloc
drivers/staging/zsmalloc/Makefile deleted +0 -3
@@ -1,3 +0,0 @@ -zsmalloc-y := zsmalloc-main.o - -obj-$(CONFIG_ZSMALLOC) += zsmalloc.o
drivers/staging/zsmalloc/zsmalloc-main.c deleted +0 -1098
1,098 lines not on this page · raw message
drivers/staging/zsmalloc/zsmalloc.h deleted +0 -50
50 lines not on this page · raw message
include/linux/zsmalloc.h new file +52 -0
52 lines not on this page · raw message
Signature · 7 lines
1.7.9.5 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Minchan Kim
maintainerPATCH v6 4/5 mm: export unmap_kernel_range
In reply to Minchan KimNow zsmalloc needs exported unmap_kernel_range for building it as module. In detail, here it is.
https://lkml.org/lkml/2013/1/18/487
We didn't send patch to make unmap_kernel_range exportable at that time. Because zram is staging stuff and we didn't think make VM function exportable for staging stuff makes sense so we decided giving up build=m for zsmalloc but zsmalloc moved under zram directory so if we can't build zsmalloc as module, it means we can't build zram as module, either. In addition, another reason we should export it is that buddy map_vm_area is already exported.
--- mm/vmalloc.c | 1 + 1 file changed, 1 insertion(+)
mm/vmalloc.c +1 -0
@@ -1254,6 +1254,7 @@ void unmap_kernel_range(unsigned long addr, unsigned long size)vunmap_page_range (addr, end);flush_tlb_kernel_range (addr, end); } +EXPORT_SYMBOL_GPL (unmap_kernel_range);int map_vm_area (struct vm_struct *area,pgprot_t prot,struct page ***pages) {
Signature · 7 lines
1.7.9.5 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Minchan Kim
maintainerPATCH v6 5/5 zram: promote zram from staging
In reply to Minchan KimZram has lived in staging for a LONG LONG time and have been fixed/improved by many contributors so code is clean and stable now. Of course, there are lots of product using zram in real practice.
The major TV companys have used zram as swap since two years ago and recently our production team released android smart phone with zram which is used as swap, too. And there was a report Google released their ChromeOS with zram, too and cyanogenmod have been used zram long time ago. And I heard some disto have used zram block device for tmpfs. In addition, I saw many report from many other peoples. For example, Lubuntu start to use it.
The benefit of zram is very clear. With my experience, one of the benefit was to remove jitter of video application with backgroud memory pressure. It would be effect of efficient memory usage by compression but more issue is whether swap is there or not in the system. Recent mobile platforms have used JAVA so there are many anonymous pages. But embedded system normally are reluctant to use eMMC or SDCard as swap because there is wear-leveling and latency issues so if we do not use swap, it means we can't reclaim anoymous pages and at last, we could encounter OOM kill. :(
Although we have real storage as swap, it was a problem, too. Because it sometime ends up making system very unresponsible caused by slow swap storage performance.
Quote from Luigi on Google
"
Since Chrome OS was mentioned: the main reason why we don't use swap to a disk (rotating or SSD) is because it doesn't degrade gracefully and leads to a bad interactive experience. Generally we prefer to manage RAM at a higher level, by transparently killing and restarting processes. But we noticed that zram is fast enough to be competitive with the latter, and it lets us make more efficient use of the available RAM.
"
and he announced. http://www.spinics.net/lists/linux-mm/msg57717.html
Other uses case is to use zram for block device. Zram is block device so anyone can format the block device and mount on it so some guys on the internet start zram as /var/tmp.
http://forums.gentoo.org/viewtopic-t-838198-start-0.html
It's time to promote it and we should accept more new features because some enhance patches have been pended until zram complete to promote from staging
In addition, block subsystem maintainer Jens already acked it so I guess there is no reason to prevent zram promotion any more and it would be one of good example to prove how staging stuffs evolve.
--- drivers/block/Kconfig | 2 + drivers/block/Makefile | 1 + drivers/block/zram/Kconfig | 37 ++ drivers/block/zram/Makefile | 3 + drivers/block/zram/zram.txt | 71 +++ drivers/block/zram/zram_drv.c | 987 +++++++++++++++++++++++++++++++++++ drivers/block/zram/zsmalloc.c | 1084 +++++++++++++++++++++++++++++++++++++++ drivers/staging/Kconfig | 2 - drivers/staging/Makefile | 1 - drivers/staging/zram/Kconfig | 38 -- drivers/staging/zram/Makefile | 3 - drivers/staging/zram/zram.txt | 77 --- drivers/staging/zram/zram_drv.c | 989 ----------------------------------- drivers/staging/zram/zram_drv.h | 124 ----- drivers/staging/zram/zsmalloc.c | 1084 --------------------------------------- include/linux/zram.h | 123 +++++ 16 files changed, 2308 insertions(+), 2318 deletions(-) create mode 100644 drivers/block/zram/Kconfig create mode 100644 drivers/block/zram/Makefile create mode 100644 drivers/block/zram/zram.txt create mode 100644 drivers/block/zram/zram_drv.c create mode 100644 drivers/block/zram/zsmalloc.c delete mode 100644 drivers/staging/zram/Kconfig delete mode 100644 drivers/staging/zram/Makefile delete mode 100644 drivers/staging/zram/zram.txt delete mode 100644 drivers/staging/zram/zram_drv.c delete mode 100644 drivers/staging/zram/zram_drv.h delete mode 100644 drivers/staging/zram/zsmalloc.c create mode 100644 include/linux/zram.h
drivers/block/Kconfig +2 -0
@@ -105,6 +105,8 @@ source "drivers/block/paride/Kconfig" source "drivers/block/mtip32xx/Kconfig" +source "drivers/block/zram/Kconfig" + config BLK_CPQ_DA tristate "Compaq SMART2 support" depends on PCI && VIRT_TO_BUS
drivers/block/Makefile +1 -0
@@ -29,6 +29,7 @@ obj-$(CONFIG_BLK_DEV_UMEM) += umem.o obj-$(CONFIG_BLK_DEV_NBD) += nbd.o obj-$(CONFIG_BLK_DEV_CRYPTOLOOP) += cryptoloop.o obj-$(CONFIG_VIRTIO_BLK) += virtio_blk.o +obj-$(CONFIG_ZRAM) += zram/ obj-$(CONFIG_VIODASD) += viodasd.o obj-$(CONFIG_BLK_DEV_SX8) += sx8.o
drivers/block/zram/Kconfig new file +37 -0
@@ -0,0 +1,37 @@ +config ZRAM + tristate "Compressed RAM block device support" + depends on BLOCK && SYSFS + select LZO_COMPRESS + select LZO_DECOMPRESS + default n + help + Creates virtual block devices called /dev/zramX (X = 0, 1, ...). + Pages written to these disks are compressed and stored in memory + itself. These disks allow very fast I/O and compression provides + good amounts of memory savings. + + It has several use cases, for example: /tmp storage, use as swap + disks and maybe many more. + + See zram.txt for more information. + +config ZRAM_DEBUG + bool "Compressed RAM block device debug support" + depends on ZRAM + default n + help + This option adds additional debugging code to the compressed + RAM block device driver. + +config PGTABLE_MAPPING + bool "Use page table mapping to access object in zsmalloc" + depends on ZRAM + help + By default, zsmalloc uses a copy-based object mapping method to + access allocations that span two pages. However, if a particular + architecture (ex, ARM) performs VM mapping faster than copying, + then you should select this. This causes zsmalloc to use page table + mapping rather than copying for object mapping. + + You can check speed with zsmalloc benchmark[1]. + [1] https://github.com/spartacus06/zsmalloc
drivers/block/zram/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +obj-$(CONFIG_ZRAM) := zram.o + +zram-y := zram_drv.o zsmalloc.o
drivers/block/zram/zram.txt new file +71 -0
71 lines not on this page · raw message
drivers/block/zram/zram_drv.c new file +987 -0
987 lines not on this page · raw message
drivers/block/zram/zsmalloc.c new file +1084 -0
1,084 lines not on this page · raw message
drivers/staging/Kconfig +0 -2
@@ -72,8 +72,6 @@ source "drivers/staging/sep/Kconfig" source "drivers/staging/iio/Kconfig" -source "drivers/staging/zram/Kconfig" - source "drivers/staging/wlags49_h2/Kconfig" source "drivers/staging/wlags49_h25/Kconfig"
drivers/staging/Makefile +0 -1
@@ -30,7 +30,6 @@ obj-$(CONFIG_VT6656) += vt6656/ obj-$(CONFIG_VME_BUS) += vme/ obj-$(CONFIG_DX_SEP) += sep/ obj-$(CONFIG_IIO) += iio/ -obj-$(CONFIG_ZRAM) += zram/ obj-$(CONFIG_WLAGS49_H2) += wlags49_h2/ obj-$(CONFIG_WLAGS49_H25) += wlags49_h25/ obj-$(CONFIG_FB_SM7XX) += sm7xxfb/
drivers/staging/zram/Kconfig deleted +0 -38
@@ -1,38 +0,0 @@ -config ZRAM - bool "Compressed RAM block device support" - depends on BLOCK && SYSFS - select LZO_COMPRESS - select LZO_DECOMPRESS - default n - help - Creates virtual block devices called /dev/zramX (X = 0, 1, ...). - Pages written to these disks are compressed and stored in memory - itself. These disks allow very fast I/O and compression provides - good amounts of memory savings. - - It has several use cases, for example: /tmp storage, use as swap - disks and maybe many more. - - See zram.txt for more information. - Project home: <https://compcache.googlecode.com/> - -config ZRAM_DEBUG - bool "Compressed RAM block device debug support" - depends on ZRAM - default n - help - This option adds additional debugging code to the compressed - RAM block device driver. - -config PGTABLE_MAPPING - bool "Use page table mapping to access object in zsmalloc" - depends on ZRAM - help - By default, zsmalloc uses a copy-based object mapping method to - access allocations that span two pages. However, if a particular - architecture (ex, ARM) performs VM mapping faster than copying, - then you should select this. This causes zsmalloc to use page table - mapping rather than copying for object mapping. - - You can check speed with zsmalloc benchmark[1]. - [1] https://github.com/spartacus06/zsmalloc
drivers/staging/zram/Makefile deleted +0 -3
@@ -1,3 +0,0 @@ -zram-y := zram_drv.o - -obj-$(CONFIG_ZRAM) += zram.o zsmalloc.o
drivers/staging/zram/zram.txt deleted +0 -77
77 lines not on this page · raw message
drivers/staging/zram/zram_drv.c deleted +0 -989
670 lines not on this page · raw message
drivers/staging/zram/zram_drv.h deleted +0 -124
124 lines not on this page · raw message
drivers/staging/zram/zsmalloc.c deleted +0 -1084
1,084 lines not on this page · raw message
include/linux/zram.h new file +123 -0
123 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 7 lines
1.7.9.5 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Part of the diff is not shown here. View the raw message.