diff options
-rw-r--r-- | Documentation/kernel-parameters.txt | 21 | ||||
-rw-r--r-- | drivers/xen/Kconfig | 7 | ||||
-rw-r--r-- | drivers/xen/balloon.c | 3 | ||||
-rw-r--r-- | drivers/xen/privcmd.c | 2 | ||||
-rw-r--r-- | drivers/xen/tmem.c | 87 | ||||
-rw-r--r-- | drivers/xen/xen-selfballoon.c | 47 | ||||
-rw-r--r-- | drivers/xen/xenbus/xenbus_dev_backend.c | 21 |
7 files changed, 82 insertions, 106 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index c3bfacb92910..6e3b18a8afc6 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -3005,6 +3005,27 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
3005 | Force threading of all interrupt handlers except those | 3005 | Force threading of all interrupt handlers except those |
3006 | marked explicitly IRQF_NO_THREAD. | 3006 | marked explicitly IRQF_NO_THREAD. |
3007 | 3007 | ||
3008 | tmem [KNL,XEN] | ||
3009 | Enable the Transcendent memory driver if built-in. | ||
3010 | |||
3011 | tmem.cleancache=0|1 [KNL, XEN] | ||
3012 | Default is on (1). Disable the usage of the cleancache | ||
3013 | API to send anonymous pages to the hypervisor. | ||
3014 | |||
3015 | tmem.frontswap=0|1 [KNL, XEN] | ||
3016 | Default is on (1). Disable the usage of the frontswap | ||
3017 | API to send swap pages to the hypervisor. If disabled | ||
3018 | the selfballooning and selfshrinking are force disabled. | ||
3019 | |||
3020 | tmem.selfballooning=0|1 [KNL, XEN] | ||
3021 | Default is on (1). Disable the driving of swap pages | ||
3022 | to the hypervisor. | ||
3023 | |||
3024 | tmem.selfshrinking=0|1 [KNL, XEN] | ||
3025 | Default is on (1). Partial swapoff that immediately | ||
3026 | transfers pages from Xen hypervisor back to the | ||
3027 | kernel based on different criteria. | ||
3028 | |||
3008 | topology= [S390] | 3029 | topology= [S390] |
3009 | Format: {off | on} | 3030 | Format: {off | on} |
3010 | Specify if the kernel should make use of the cpu | 3031 | Specify if the kernel should make use of the cpu |
diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index f03bf501527f..9e02d60a364b 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig | |||
@@ -19,11 +19,10 @@ config XEN_SELFBALLOONING | |||
19 | by the current usage of anonymous memory ("committed AS") and | 19 | by the current usage of anonymous memory ("committed AS") and |
20 | controlled by various sysfs-settable parameters. Configuring | 20 | controlled by various sysfs-settable parameters. Configuring |
21 | FRONTSWAP is highly recommended; if it is not configured, self- | 21 | FRONTSWAP is highly recommended; if it is not configured, self- |
22 | ballooning is disabled by default but can be enabled with the | 22 | ballooning is disabled by default. If FRONTSWAP is configured, |
23 | 'selfballooning' kernel boot parameter. If FRONTSWAP is configured, | ||
24 | frontswap-selfshrinking is enabled by default but can be disabled | 23 | frontswap-selfshrinking is enabled by default but can be disabled |
25 | with the 'noselfshrink' kernel boot parameter; and self-ballooning | 24 | with the 'tmem.selfshrink=0' kernel boot parameter; and self-ballooning |
26 | is enabled by default but can be disabled with the 'noselfballooning' | 25 | is enabled by default but can be disabled with the 'tmem.selfballooning=0' |
27 | kernel boot parameter. Note that systems without a sufficiently | 26 | kernel boot parameter. Note that systems without a sufficiently |
28 | large swap device should not enable self-ballooning. | 27 | large swap device should not enable self-ballooning. |
29 | 28 | ||
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index a56776dbe095..930fb6817901 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
@@ -407,7 +407,8 @@ static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) | |||
407 | nr_pages = ARRAY_SIZE(frame_list); | 407 | nr_pages = ARRAY_SIZE(frame_list); |
408 | 408 | ||
409 | for (i = 0; i < nr_pages; i++) { | 409 | for (i = 0; i < nr_pages; i++) { |
410 | if ((page = alloc_page(gfp)) == NULL) { | 410 | page = alloc_page(gfp); |
411 | if (page == NULL) { | ||
411 | nr_pages = i; | 412 | nr_pages = i; |
412 | state = BP_EAGAIN; | 413 | state = BP_EAGAIN; |
413 | break; | 414 | break; |
diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c index ca2b00e9d558..2cfc24d76fc5 100644 --- a/drivers/xen/privcmd.c +++ b/drivers/xen/privcmd.c | |||
@@ -504,7 +504,7 @@ static void privcmd_close(struct vm_area_struct *vma) | |||
504 | struct page **pages = vma->vm_private_data; | 504 | struct page **pages = vma->vm_private_data; |
505 | int numpgs = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; | 505 | int numpgs = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; |
506 | 506 | ||
507 | if (!xen_feature(XENFEAT_auto_translated_physmap || !numpgs || !pages)) | 507 | if (!xen_feature(XENFEAT_auto_translated_physmap) || !numpgs || !pages) |
508 | return; | 508 | return; |
509 | 509 | ||
510 | xen_unmap_domain_mfn_range(vma, numpgs, pages); | 510 | xen_unmap_domain_mfn_range(vma, numpgs, pages); |
diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c index e3600be4e7fa..18e8bd8fa947 100644 --- a/drivers/xen/tmem.c +++ b/drivers/xen/tmem.c | |||
@@ -11,11 +11,7 @@ | |||
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/pagemap.h> | 12 | #include <linux/pagemap.h> |
13 | #include <linux/cleancache.h> | 13 | #include <linux/cleancache.h> |
14 | |||
15 | /* temporary ifdef until include/linux/frontswap.h is upstream */ | ||
16 | #ifdef CONFIG_FRONTSWAP | ||
17 | #include <linux/frontswap.h> | 14 | #include <linux/frontswap.h> |
18 | #endif | ||
19 | 15 | ||
20 | #include <xen/xen.h> | 16 | #include <xen/xen.h> |
21 | #include <xen/interface/xen.h> | 17 | #include <xen/interface/xen.h> |
@@ -24,6 +20,34 @@ | |||
24 | #include <asm/xen/hypervisor.h> | 20 | #include <asm/xen/hypervisor.h> |
25 | #include <xen/tmem.h> | 21 | #include <xen/tmem.h> |
26 | 22 | ||
23 | #ifndef CONFIG_XEN_TMEM_MODULE | ||
24 | bool __read_mostly tmem_enabled = false; | ||
25 | |||
26 | static int __init enable_tmem(char *s) | ||
27 | { | ||
28 | tmem_enabled = true; | ||
29 | return 1; | ||
30 | } | ||
31 | __setup("tmem", enable_tmem); | ||
32 | #endif | ||
33 | |||
34 | #ifdef CONFIG_CLEANCACHE | ||
35 | static bool cleancache __read_mostly = true; | ||
36 | module_param(cleancache, bool, S_IRUGO); | ||
37 | static bool selfballooning __read_mostly = true; | ||
38 | module_param(selfballooning, bool, S_IRUGO); | ||
39 | #endif /* CONFIG_CLEANCACHE */ | ||
40 | |||
41 | #ifdef CONFIG_FRONTSWAP | ||
42 | static bool frontswap __read_mostly = true; | ||
43 | module_param(frontswap, bool, S_IRUGO); | ||
44 | #endif /* CONFIG_FRONTSWAP */ | ||
45 | |||
46 | #ifdef CONFIG_XEN_SELFBALLOONING | ||
47 | static bool selfshrinking __read_mostly = true; | ||
48 | module_param(selfshrinking, bool, S_IRUGO); | ||
49 | #endif /* CONFIG_XEN_SELFBALLOONING */ | ||
50 | |||
27 | #define TMEM_CONTROL 0 | 51 | #define TMEM_CONTROL 0 |
28 | #define TMEM_NEW_POOL 1 | 52 | #define TMEM_NEW_POOL 1 |
29 | #define TMEM_DESTROY_POOL 2 | 53 | #define TMEM_DESTROY_POOL 2 |
@@ -129,16 +153,6 @@ static int xen_tmem_flush_object(u32 pool_id, struct tmem_oid oid) | |||
129 | return xen_tmem_op(TMEM_FLUSH_OBJECT, pool_id, oid, 0, 0, 0, 0, 0); | 153 | return xen_tmem_op(TMEM_FLUSH_OBJECT, pool_id, oid, 0, 0, 0, 0, 0); |
130 | } | 154 | } |
131 | 155 | ||
132 | #ifndef CONFIG_XEN_TMEM_MODULE | ||
133 | bool __read_mostly tmem_enabled = false; | ||
134 | |||
135 | static int __init enable_tmem(char *s) | ||
136 | { | ||
137 | tmem_enabled = true; | ||
138 | return 1; | ||
139 | } | ||
140 | __setup("tmem", enable_tmem); | ||
141 | #endif | ||
142 | 156 | ||
143 | #ifdef CONFIG_CLEANCACHE | 157 | #ifdef CONFIG_CLEANCACHE |
144 | static int xen_tmem_destroy_pool(u32 pool_id) | 158 | static int xen_tmem_destroy_pool(u32 pool_id) |
@@ -230,20 +244,6 @@ static int tmem_cleancache_init_shared_fs(char *uuid, size_t pagesize) | |||
230 | return xen_tmem_new_pool(shared_uuid, TMEM_POOL_SHARED, pagesize); | 244 | return xen_tmem_new_pool(shared_uuid, TMEM_POOL_SHARED, pagesize); |
231 | } | 245 | } |
232 | 246 | ||
233 | static bool disable_cleancache __read_mostly; | ||
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 | ||
239 | static int __init no_cleancache(char *s) | ||
240 | { | ||
241 | disable_cleancache = true; | ||
242 | return 1; | ||
243 | } | ||
244 | __setup("nocleancache", no_cleancache); | ||
245 | #endif | ||
246 | |||
247 | static struct cleancache_ops tmem_cleancache_ops = { | 247 | static struct cleancache_ops tmem_cleancache_ops = { |
248 | .put_page = tmem_cleancache_put_page, | 248 | .put_page = tmem_cleancache_put_page, |
249 | .get_page = tmem_cleancache_get_page, | 249 | .get_page = tmem_cleancache_get_page, |
@@ -361,20 +361,6 @@ static void tmem_frontswap_init(unsigned ignored) | |||
361 | xen_tmem_new_pool(private, TMEM_POOL_PERSIST, PAGE_SIZE); | 361 | xen_tmem_new_pool(private, TMEM_POOL_PERSIST, PAGE_SIZE); |
362 | } | 362 | } |
363 | 363 | ||
364 | static bool disable_frontswap __read_mostly; | ||
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 | ||
370 | static int __init no_frontswap(char *s) | ||
371 | { | ||
372 | disable_frontswap = true; | ||
373 | return 1; | ||
374 | } | ||
375 | __setup("nofrontswap", no_frontswap); | ||
376 | #endif | ||
377 | |||
378 | static struct frontswap_ops tmem_frontswap_ops = { | 364 | static struct frontswap_ops tmem_frontswap_ops = { |
379 | .store = tmem_frontswap_store, | 365 | .store = tmem_frontswap_store, |
380 | .load = tmem_frontswap_load, | 366 | .load = tmem_frontswap_load, |
@@ -382,8 +368,6 @@ static struct frontswap_ops tmem_frontswap_ops = { | |||
382 | .invalidate_area = tmem_frontswap_flush_area, | 368 | .invalidate_area = tmem_frontswap_flush_area, |
383 | .init = tmem_frontswap_init | 369 | .init = tmem_frontswap_init |
384 | }; | 370 | }; |
385 | #else /* CONFIG_FRONTSWAP */ | ||
386 | #define disable_frontswap_selfshrinking 1 | ||
387 | #endif | 371 | #endif |
388 | 372 | ||
389 | static int xen_tmem_init(void) | 373 | static int xen_tmem_init(void) |
@@ -391,7 +375,7 @@ static int xen_tmem_init(void) | |||
391 | if (!xen_domain()) | 375 | if (!xen_domain()) |
392 | return 0; | 376 | return 0; |
393 | #ifdef CONFIG_FRONTSWAP | 377 | #ifdef CONFIG_FRONTSWAP |
394 | if (tmem_enabled && !disable_frontswap) { | 378 | if (tmem_enabled && frontswap) { |
395 | char *s = ""; | 379 | char *s = ""; |
396 | struct frontswap_ops *old_ops = | 380 | struct frontswap_ops *old_ops = |
397 | frontswap_register_ops(&tmem_frontswap_ops); | 381 | frontswap_register_ops(&tmem_frontswap_ops); |
@@ -408,7 +392,7 @@ static int xen_tmem_init(void) | |||
408 | #endif | 392 | #endif |
409 | #ifdef CONFIG_CLEANCACHE | 393 | #ifdef CONFIG_CLEANCACHE |
410 | BUG_ON(sizeof(struct cleancache_filekey) != sizeof(struct tmem_oid)); | 394 | BUG_ON(sizeof(struct cleancache_filekey) != sizeof(struct tmem_oid)); |
411 | if (tmem_enabled && !disable_cleancache) { | 395 | if (tmem_enabled && cleancache) { |
412 | char *s = ""; | 396 | char *s = ""; |
413 | struct cleancache_ops *old_ops = | 397 | struct cleancache_ops *old_ops = |
414 | cleancache_register_ops(&tmem_cleancache_ops); | 398 | cleancache_register_ops(&tmem_cleancache_ops); |
@@ -419,8 +403,15 @@ static int xen_tmem_init(void) | |||
419 | } | 403 | } |
420 | #endif | 404 | #endif |
421 | #ifdef CONFIG_XEN_SELFBALLOONING | 405 | #ifdef CONFIG_XEN_SELFBALLOONING |
422 | xen_selfballoon_init(!disable_selfballooning, | 406 | /* |
423 | !disable_frontswap_selfshrinking); | 407 | * There is no point of driving pages to the swap system if they |
408 | * aren't going anywhere in tmem universe. | ||
409 | */ | ||
410 | if (!frontswap) { | ||
411 | selfshrinking = false; | ||
412 | selfballooning = false; | ||
413 | } | ||
414 | xen_selfballoon_init(selfballooning, selfshrinking); | ||
424 | #endif | 415 | #endif |
425 | return 0; | 416 | return 0; |
426 | } | 417 | } |
diff --git a/drivers/xen/xen-selfballoon.c b/drivers/xen/xen-selfballoon.c index f2ef569c7cc1..f70984a892aa 100644 --- a/drivers/xen/xen-selfballoon.c +++ b/drivers/xen/xen-selfballoon.c | |||
@@ -53,15 +53,12 @@ | |||
53 | * System configuration note: Selfballooning should not be enabled on | 53 | * System configuration note: Selfballooning should not be enabled on |
54 | * systems without a sufficiently large swap device configured; for best | 54 | * systems without a sufficiently large swap device configured; for best |
55 | * results, it is recommended that total swap be increased by the size | 55 | * results, it is recommended that total swap be increased by the size |
56 | * of the guest memory. Also, while technically not required to be | 56 | * of the guest memory. Note, that selfballooning should be disabled by default |
57 | * configured, it is highly recommended that frontswap also be configured | 57 | * if frontswap is not configured. Similarly selfballooning should be enabled |
58 | * and enabled when selfballooning is running. So, selfballooning | 58 | * by default if frontswap is configured and can be disabled with the |
59 | * is disabled by default if frontswap is not configured and can only | 59 | * "tmem.selfballooning=0" kernel boot option. Finally, when frontswap is |
60 | * be enabled with the "selfballooning" kernel boot option; similarly | 60 | * configured, frontswap-selfshrinking can be disabled with the |
61 | * selfballooning is enabled by default if frontswap is configured and | 61 | * "tmem.selfshrink=0" kernel boot option. |
62 | * can be disabled with the "noselfballooning" kernel boot option. Finally, | ||
63 | * when frontswap is configured, frontswap-selfshrinking can be disabled | ||
64 | * with the "noselfshrink" kernel boot option. | ||
65 | * | 62 | * |
66 | * Selfballooning is disallowed in domain0 and force-disabled. | 63 | * Selfballooning is disallowed in domain0 and force-disabled. |
67 | * | 64 | * |
@@ -120,9 +117,6 @@ static DECLARE_DELAYED_WORK(selfballoon_worker, selfballoon_process); | |||
120 | /* Enable/disable with sysfs. */ | 117 | /* Enable/disable with sysfs. */ |
121 | static bool frontswap_selfshrinking __read_mostly; | 118 | static bool frontswap_selfshrinking __read_mostly; |
122 | 119 | ||
123 | /* Enable/disable with kernel boot option. */ | ||
124 | static bool use_frontswap_selfshrink = true; | ||
125 | |||
126 | /* | 120 | /* |
127 | * The default values for the following parameters were deemed reasonable | 121 | * The default values for the following parameters were deemed reasonable |
128 | * by experimentation, may be workload-dependent, and can all be | 122 | * by experimentation, may be workload-dependent, and can all be |
@@ -176,35 +170,6 @@ static void frontswap_selfshrink(void) | |||
176 | frontswap_shrink(tgt_frontswap_pages); | 170 | frontswap_shrink(tgt_frontswap_pages); |
177 | } | 171 | } |
178 | 172 | ||
179 | static int __init xen_nofrontswap_selfshrink_setup(char *s) | ||
180 | { | ||
181 | use_frontswap_selfshrink = false; | ||
182 | return 1; | ||
183 | } | ||
184 | |||
185 | __setup("noselfshrink", xen_nofrontswap_selfshrink_setup); | ||
186 | |||
187 | /* Disable with kernel boot option. */ | ||
188 | static bool use_selfballooning = true; | ||
189 | |||
190 | static int __init xen_noselfballooning_setup(char *s) | ||
191 | { | ||
192 | use_selfballooning = false; | ||
193 | return 1; | ||
194 | } | ||
195 | |||
196 | __setup("noselfballooning", xen_noselfballooning_setup); | ||
197 | #else /* !CONFIG_FRONTSWAP */ | ||
198 | /* Enable with kernel boot option. */ | ||
199 | static bool use_selfballooning; | ||
200 | |||
201 | static int __init xen_selfballooning_setup(char *s) | ||
202 | { | ||
203 | use_selfballooning = true; | ||
204 | return 1; | ||
205 | } | ||
206 | |||
207 | __setup("selfballooning", xen_selfballooning_setup); | ||
208 | #endif /* CONFIG_FRONTSWAP */ | 173 | #endif /* CONFIG_FRONTSWAP */ |
209 | 174 | ||
210 | #define MB2PAGES(mb) ((mb) << (20 - PAGE_SHIFT)) | 175 | #define MB2PAGES(mb) ((mb) << (20 - PAGE_SHIFT)) |
diff --git a/drivers/xen/xenbus/xenbus_dev_backend.c b/drivers/xen/xenbus/xenbus_dev_backend.c index d73000800762..a6f42fc01407 100644 --- a/drivers/xen/xenbus/xenbus_dev_backend.c +++ b/drivers/xen/xenbus/xenbus_dev_backend.c | |||
@@ -70,22 +70,21 @@ static long xenbus_alloc(domid_t domid) | |||
70 | return err; | 70 | return err; |
71 | } | 71 | } |
72 | 72 | ||
73 | static long xenbus_backend_ioctl(struct file *file, unsigned int cmd, unsigned long data) | 73 | static long xenbus_backend_ioctl(struct file *file, unsigned int cmd, |
74 | unsigned long data) | ||
74 | { | 75 | { |
75 | if (!capable(CAP_SYS_ADMIN)) | 76 | if (!capable(CAP_SYS_ADMIN)) |
76 | return -EPERM; | 77 | return -EPERM; |
77 | 78 | ||
78 | switch (cmd) { | 79 | switch (cmd) { |
79 | case IOCTL_XENBUS_BACKEND_EVTCHN: | 80 | case IOCTL_XENBUS_BACKEND_EVTCHN: |
80 | if (xen_store_evtchn > 0) | 81 | if (xen_store_evtchn > 0) |
81 | return xen_store_evtchn; | 82 | return xen_store_evtchn; |
82 | return -ENODEV; | 83 | return -ENODEV; |
83 | 84 | case IOCTL_XENBUS_BACKEND_SETUP: | |
84 | case IOCTL_XENBUS_BACKEND_SETUP: | 85 | return xenbus_alloc(data); |
85 | return xenbus_alloc(data); | 86 | default: |
86 | 87 | return -ENOTTY; | |
87 | default: | ||
88 | return -ENOTTY; | ||
89 | } | 88 | } |
90 | } | 89 | } |
91 | 90 | ||