diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-30 20:37:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-30 20:37:43 -0400 |
commit | 5f56886521d6ddd3648777fae44d82382dd8c87f (patch) | |
tree | aa0db6331cdb01c23f1884439840aadd31bbcca4 /drivers/xen/tmem.c | |
parent | f1e9a236e5ddab6c349611ee86f54291916f226c (diff) | |
parent | e2a8b0a779787314eca1061308a8182e6c5bfabd (diff) |
Merge branch 'akpm' (incoming from Andrew)
Merge third batch of fixes from Andrew Morton:
"Most of the rest. I still have two large patchsets against AIO and
IPC, but they're a bit stuck behind other trees and I'm about to
vanish for six days.
- random fixlets
- inotify
- more of the MM queue
- show_stack() cleanups
- DMI update
- kthread/workqueue things
- compat cleanups
- epoll udpates
- binfmt updates
- nilfs2
- hfs
- hfsplus
- ptrace
- kmod
- coredump
- kexec
- rbtree
- pids
- pidns
- pps
- semaphore tweaks
- some w1 patches
- relay updates
- core Kconfig changes
- sysrq tweaks"
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (109 commits)
Documentation/sysrq: fix inconstistent help message of sysrq key
ethernet/emac/sysrq: fix inconstistent help message of sysrq key
sparc/sysrq: fix inconstistent help message of sysrq key
powerpc/xmon/sysrq: fix inconstistent help message of sysrq key
ARM/etm/sysrq: fix inconstistent help message of sysrq key
power/sysrq: fix inconstistent help message of sysrq key
kgdb/sysrq: fix inconstistent help message of sysrq key
lib/decompress.c: fix initconst
notifier-error-inject: fix module names in Kconfig
kernel/sys.c: make prctl(PR_SET_MM) generally available
UAPI: remove empty Kbuild files
menuconfig: print more info for symbol without prompts
init/Kconfig: re-order CONFIG_EXPERT options to fix menuconfig display
kconfig menu: move Virtualization drivers near other virtualization options
Kconfig: consolidate CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
relay: use macro PAGE_ALIGN instead of FIX_SIZE
kernel/relay.c: move FIX_SIZE macro into relay.c
kernel/relay.c: remove unused function argument actor
drivers/w1/slaves/w1_ds2760.c: fix the error handling in w1_ds2760_add_slave()
drivers/w1/slaves/w1_ds2781.c: fix the error handling in w1_ds2781_add_slave()
...
Diffstat (limited to 'drivers/xen/tmem.c')
-rw-r--r-- | drivers/xen/tmem.c | 55 |
1 files changed, 40 insertions, 15 deletions
diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c index 3ee836d42581..e3600be4e7fa 100644 --- a/drivers/xen/tmem.c +++ b/drivers/xen/tmem.c | |||
@@ -5,6 +5,7 @@ | |||
5 | * Author: Dan Magenheimer | 5 | * Author: Dan Magenheimer |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/module.h> | ||
8 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
9 | #include <linux/types.h> | 10 | #include <linux/types.h> |
10 | #include <linux/init.h> | 11 | #include <linux/init.h> |
@@ -128,6 +129,7 @@ static int xen_tmem_flush_object(u32 pool_id, struct tmem_oid oid) | |||
128 | return xen_tmem_op(TMEM_FLUSH_OBJECT, pool_id, oid, 0, 0, 0, 0, 0); | 129 | return xen_tmem_op(TMEM_FLUSH_OBJECT, pool_id, oid, 0, 0, 0, 0, 0); |
129 | } | 130 | } |
130 | 131 | ||
132 | #ifndef CONFIG_XEN_TMEM_MODULE | ||
131 | bool __read_mostly tmem_enabled = false; | 133 | bool __read_mostly tmem_enabled = false; |
132 | 134 | ||
133 | static int __init enable_tmem(char *s) | 135 | static int __init enable_tmem(char *s) |
@@ -136,6 +138,7 @@ static int __init enable_tmem(char *s) | |||
136 | return 1; | 138 | return 1; |
137 | } | 139 | } |
138 | __setup("tmem", enable_tmem); | 140 | __setup("tmem", enable_tmem); |
141 | #endif | ||
139 | 142 | ||
140 | #ifdef CONFIG_CLEANCACHE | 143 | #ifdef CONFIG_CLEANCACHE |
141 | static int xen_tmem_destroy_pool(u32 pool_id) | 144 | static int xen_tmem_destroy_pool(u32 pool_id) |
@@ -227,16 +230,21 @@ static int tmem_cleancache_init_shared_fs(char *uuid, size_t pagesize) | |||
227 | return xen_tmem_new_pool(shared_uuid, TMEM_POOL_SHARED, pagesize); | 230 | return xen_tmem_new_pool(shared_uuid, TMEM_POOL_SHARED, pagesize); |
228 | } | 231 | } |
229 | 232 | ||
230 | static bool __initdata use_cleancache = true; | 233 | static bool disable_cleancache __read_mostly; |
231 | 234 | static bool disable_selfballooning __read_mostly; | |
235 | #ifdef CONFIG_XEN_TMEM_MODULE | ||
236 | module_param(disable_cleancache, bool, S_IRUGO); | ||
237 | module_param(disable_selfballooning, bool, S_IRUGO); | ||
238 | #else | ||
232 | static int __init no_cleancache(char *s) | 239 | static int __init no_cleancache(char *s) |
233 | { | 240 | { |
234 | use_cleancache = false; | 241 | disable_cleancache = true; |
235 | return 1; | 242 | return 1; |
236 | } | 243 | } |
237 | __setup("nocleancache", no_cleancache); | 244 | __setup("nocleancache", no_cleancache); |
245 | #endif | ||
238 | 246 | ||
239 | static struct cleancache_ops __initdata tmem_cleancache_ops = { | 247 | static struct cleancache_ops tmem_cleancache_ops = { |
240 | .put_page = tmem_cleancache_put_page, | 248 | .put_page = tmem_cleancache_put_page, |
241 | .get_page = tmem_cleancache_get_page, | 249 | .get_page = tmem_cleancache_get_page, |
242 | .invalidate_page = tmem_cleancache_flush_page, | 250 | .invalidate_page = tmem_cleancache_flush_page, |
@@ -353,54 +361,71 @@ static void tmem_frontswap_init(unsigned ignored) | |||
353 | xen_tmem_new_pool(private, TMEM_POOL_PERSIST, PAGE_SIZE); | 361 | xen_tmem_new_pool(private, TMEM_POOL_PERSIST, PAGE_SIZE); |
354 | } | 362 | } |
355 | 363 | ||
356 | static bool __initdata use_frontswap = true; | 364 | static bool disable_frontswap __read_mostly; |
357 | 365 | static bool disable_frontswap_selfshrinking __read_mostly; | |
366 | #ifdef CONFIG_XEN_TMEM_MODULE | ||
367 | module_param(disable_frontswap, bool, S_IRUGO); | ||
368 | module_param(disable_frontswap_selfshrinking, bool, S_IRUGO); | ||
369 | #else | ||
358 | static int __init no_frontswap(char *s) | 370 | static int __init no_frontswap(char *s) |
359 | { | 371 | { |
360 | use_frontswap = false; | 372 | disable_frontswap = true; |
361 | return 1; | 373 | return 1; |
362 | } | 374 | } |
363 | __setup("nofrontswap", no_frontswap); | 375 | __setup("nofrontswap", no_frontswap); |
376 | #endif | ||
364 | 377 | ||
365 | static struct frontswap_ops __initdata tmem_frontswap_ops = { | 378 | static struct frontswap_ops tmem_frontswap_ops = { |
366 | .store = tmem_frontswap_store, | 379 | .store = tmem_frontswap_store, |
367 | .load = tmem_frontswap_load, | 380 | .load = tmem_frontswap_load, |
368 | .invalidate_page = tmem_frontswap_flush_page, | 381 | .invalidate_page = tmem_frontswap_flush_page, |
369 | .invalidate_area = tmem_frontswap_flush_area, | 382 | .invalidate_area = tmem_frontswap_flush_area, |
370 | .init = tmem_frontswap_init | 383 | .init = tmem_frontswap_init |
371 | }; | 384 | }; |
385 | #else /* CONFIG_FRONTSWAP */ | ||
386 | #define disable_frontswap_selfshrinking 1 | ||
372 | #endif | 387 | #endif |
373 | 388 | ||
374 | static int __init xen_tmem_init(void) | 389 | static int xen_tmem_init(void) |
375 | { | 390 | { |
376 | if (!xen_domain()) | 391 | if (!xen_domain()) |
377 | return 0; | 392 | return 0; |
378 | #ifdef CONFIG_FRONTSWAP | 393 | #ifdef CONFIG_FRONTSWAP |
379 | if (tmem_enabled && use_frontswap) { | 394 | if (tmem_enabled && !disable_frontswap) { |
380 | char *s = ""; | 395 | char *s = ""; |
381 | struct frontswap_ops old_ops = | 396 | struct frontswap_ops *old_ops = |
382 | frontswap_register_ops(&tmem_frontswap_ops); | 397 | frontswap_register_ops(&tmem_frontswap_ops); |
383 | 398 | ||
384 | tmem_frontswap_poolid = -1; | 399 | tmem_frontswap_poolid = -1; |
385 | if (old_ops.init != NULL) | 400 | if (IS_ERR(old_ops) || old_ops) { |
401 | if (IS_ERR(old_ops)) | ||
402 | return PTR_ERR(old_ops); | ||
386 | s = " (WARNING: frontswap_ops overridden)"; | 403 | s = " (WARNING: frontswap_ops overridden)"; |
404 | } | ||
387 | printk(KERN_INFO "frontswap enabled, RAM provided by " | 405 | printk(KERN_INFO "frontswap enabled, RAM provided by " |
388 | "Xen Transcendent Memory%s\n", s); | 406 | "Xen Transcendent Memory%s\n", s); |
389 | } | 407 | } |
390 | #endif | 408 | #endif |
391 | #ifdef CONFIG_CLEANCACHE | 409 | #ifdef CONFIG_CLEANCACHE |
392 | BUG_ON(sizeof(struct cleancache_filekey) != sizeof(struct tmem_oid)); | 410 | BUG_ON(sizeof(struct cleancache_filekey) != sizeof(struct tmem_oid)); |
393 | if (tmem_enabled && use_cleancache) { | 411 | if (tmem_enabled && !disable_cleancache) { |
394 | char *s = ""; | 412 | char *s = ""; |
395 | struct cleancache_ops old_ops = | 413 | struct cleancache_ops *old_ops = |
396 | cleancache_register_ops(&tmem_cleancache_ops); | 414 | cleancache_register_ops(&tmem_cleancache_ops); |
397 | if (old_ops.init_fs != NULL) | 415 | if (old_ops) |
398 | s = " (WARNING: cleancache_ops overridden)"; | 416 | s = " (WARNING: cleancache_ops overridden)"; |
399 | printk(KERN_INFO "cleancache enabled, RAM provided by " | 417 | printk(KERN_INFO "cleancache enabled, RAM provided by " |
400 | "Xen Transcendent Memory%s\n", s); | 418 | "Xen Transcendent Memory%s\n", s); |
401 | } | 419 | } |
402 | #endif | 420 | #endif |
421 | #ifdef CONFIG_XEN_SELFBALLOONING | ||
422 | xen_selfballoon_init(!disable_selfballooning, | ||
423 | !disable_frontswap_selfshrinking); | ||
424 | #endif | ||
403 | return 0; | 425 | return 0; |
404 | } | 426 | } |
405 | 427 | ||
406 | module_init(xen_tmem_init) | 428 | module_init(xen_tmem_init) |
429 | MODULE_LICENSE("GPL"); | ||
430 | MODULE_AUTHOR("Dan Magenheimer <dan.magenheimer@oracle.com>"); | ||
431 | MODULE_DESCRIPTION("Shim to Xen transcendent memory"); | ||