Commit 3c8bb7aab9ad84bce7d81878fda64d631089a88d
Committed by
Greg Kroah-Hartman
1 parent
5caf8fca2d
Exists in
master
and in
7 other branches
staging: Allow sharing xvmalloc for zram and zcache
Both zram and zcache use xvmalloc allocator. If xvmalloc is compiled separately for both of them, we will get linker error if they are both selected as "built-in". We can also get linker error regarding missing xvmalloc symbols if zram is not built. So, we now compile xvmalloc separately and export its symbols which are then used by both of zram and zcache. Signed-off-by: Nitin Gupta <ngupta@vflare.org> Acked-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Showing 5 changed files with 19 additions and 2 deletions Side-by-side Diff
drivers/staging/Makefile
... | ... | @@ -45,6 +45,7 @@ |
45 | 45 | obj-$(CONFIG_IIO) += iio/ |
46 | 46 | obj-$(CONFIG_CS5535_GPIO) += cs5535_gpio/ |
47 | 47 | obj-$(CONFIG_ZRAM) += zram/ |
48 | +obj-$(CONFIG_XVMALLOC) += zram/ | |
48 | 49 | obj-$(CONFIG_ZCACHE) += zcache/ |
49 | 50 | obj-$(CONFIG_WLAGS49_H2) += wlags49_h2/ |
50 | 51 | obj-$(CONFIG_WLAGS49_H25) += wlags49_h25/ |
drivers/staging/zcache/Makefile
drivers/staging/zram/Kconfig
drivers/staging/zram/Makefile
drivers/staging/zram/xvmalloc.c
... | ... | @@ -14,6 +14,8 @@ |
14 | 14 | #define DEBUG |
15 | 15 | #endif |
16 | 16 | |
17 | +#include <linux/module.h> | |
18 | +#include <linux/kernel.h> | |
17 | 19 | #include <linux/bitops.h> |
18 | 20 | #include <linux/errno.h> |
19 | 21 | #include <linux/highmem.h> |
20 | 22 | |
... | ... | @@ -315,11 +317,13 @@ |
315 | 317 | |
316 | 318 | return pool; |
317 | 319 | } |
320 | +EXPORT_SYMBOL_GPL(xv_create_pool); | |
318 | 321 | |
319 | 322 | void xv_destroy_pool(struct xv_pool *pool) |
320 | 323 | { |
321 | 324 | kfree(pool); |
322 | 325 | } |
326 | +EXPORT_SYMBOL_GPL(xv_destroy_pool); | |
323 | 327 | |
324 | 328 | /** |
325 | 329 | * xv_malloc - Allocate block of given size from pool. |
... | ... | @@ -408,6 +412,7 @@ |
408 | 412 | |
409 | 413 | return 0; |
410 | 414 | } |
415 | +EXPORT_SYMBOL_GPL(xv_malloc); | |
411 | 416 | |
412 | 417 | /* |
413 | 418 | * Free block identified with <page, offset> |
... | ... | @@ -484,6 +489,7 @@ |
484 | 489 | put_ptr_atomic(page_start, KM_USER0); |
485 | 490 | spin_unlock(&pool->lock); |
486 | 491 | } |
492 | +EXPORT_SYMBOL_GPL(xv_free); | |
487 | 493 | |
488 | 494 | u32 xv_get_object_size(void *obj) |
489 | 495 | { |
... | ... | @@ -492,6 +498,7 @@ |
492 | 498 | blk = (struct block_header *)((char *)(obj) - XV_ALIGN); |
493 | 499 | return blk->size; |
494 | 500 | } |
501 | +EXPORT_SYMBOL_GPL(xv_get_object_size); | |
495 | 502 | |
496 | 503 | /* |
497 | 504 | * Returns total memory used by allocator (userdata + metadata) |
... | ... | @@ -500,4 +507,5 @@ |
500 | 507 | { |
501 | 508 | return pool->total_pages << PAGE_SHIFT; |
502 | 509 | } |
510 | +EXPORT_SYMBOL_GPL(xv_get_total_size_bytes); |