From 9eff37a8713939f218ab8bf0dc93f1d67af7b8b4 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Mon, 5 Nov 2012 09:42:17 +0300 Subject: xen/privcmd: fix condition in privcmd_close() The parenthesis are in the wrong place so the original code is equivalent to: if (!xen_feature(XENFEAT_writable_descriptor_tables)) { ... Which obviously was not intended. Signed-off-by: Dan Carpenter Signed-off-by: Konrad Rzeszutek Wilk --- drivers/xen/privcmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) struct page **pages = vma->vm_private_data; int numpgs = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; - if (!xen_feature(XENFEAT_auto_translated_physmap || !numpgs || !pages)) + if (!xen_feature(XENFEAT_auto_translated_physmap) || !numpgs || !pages) return; xen_unmap_domain_mfn_range(vma, numpgs, pages); -- cgit v1.2.1 From a5e9cd952e2ee215286ea3ec5e6b3aa669e04e0e Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Wed, 8 May 2013 15:16:23 -0400 Subject: xen/tmem: Cleanup. Remove the parts that say temporary. Frontswap is upstream, no need to having this #ifdef. Signed-off-by: Konrad Rzeszutek Wilk --- drivers/xen/tmem.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c index e3600be4e7fa..5686d6d1a4b5 100644 --- a/drivers/xen/tmem.c +++ b/drivers/xen/tmem.c @@ -11,11 +11,7 @@ #include #include #include - -/* temporary ifdef until include/linux/frontswap.h is upstream */ -#ifdef CONFIG_FRONTSWAP #include -#endif #include #include -- cgit v1.2.1 From 0cb401d44e1152658c99c8566de915c2d71eab9e Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Wed, 8 May 2013 15:50:59 -0400 Subject: xen/tmem: Move all of the boot and module parameters to the top of the file. Just code movement to see the different boot or module parameters. Signed-off-by: Konrad Rzeszutek Wilk --- drivers/xen/tmem.c | 85 +++++++++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 40 deletions(-) diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c index 5686d6d1a4b5..edf7e18a1c05 100644 --- a/drivers/xen/tmem.c +++ b/drivers/xen/tmem.c @@ -20,6 +20,51 @@ #include #include +#ifndef CONFIG_XEN_TMEM_MODULE +bool __read_mostly tmem_enabled = false; + +static int __init enable_tmem(char *s) +{ + tmem_enabled = true; + return 1; +} +__setup("tmem", enable_tmem); +#endif + +#ifdef CONFIG_CLEANCACHE +static bool disable_cleancache __read_mostly; +static bool disable_selfballooning __read_mostly; +#ifdef CONFIG_XEN_TMEM_MODULE +module_param(disable_cleancache, bool, S_IRUGO); +module_param(disable_selfballooning, bool, S_IRUGO); +#else +static int __init no_cleancache(char *s) +{ + disable_cleancache = true; + return 1; +} +__setup("nocleancache", no_cleancache); +#endif +#endif /* CONFIG_CLEANCACHE */ + +#ifdef CONFIG_FRONTSWAP +static bool disable_frontswap __read_mostly; +static bool disable_frontswap_selfshrinking __read_mostly; +#ifdef CONFIG_XEN_TMEM_MODULE +module_param(disable_frontswap, bool, S_IRUGO); +module_param(disable_frontswap_selfshrinking, bool, S_IRUGO); +#else +static int __init no_frontswap(char *s) +{ + disable_frontswap = true; + return 1; +} +__setup("nofrontswap", no_frontswap); +#endif +#else /* CONFIG_FRONTSWAP */ +#define disable_frontswap_selfshrinking 1 +#endif /* CONFIG_FRONTSWAP */ + #define TMEM_CONTROL 0 #define TMEM_NEW_POOL 1 #define TMEM_DESTROY_POOL 2 @@ -125,16 +170,6 @@ static int xen_tmem_flush_object(u32 pool_id, struct tmem_oid oid) return xen_tmem_op(TMEM_FLUSH_OBJECT, pool_id, oid, 0, 0, 0, 0, 0); } -#ifndef CONFIG_XEN_TMEM_MODULE -bool __read_mostly tmem_enabled = false; - -static int __init enable_tmem(char *s) -{ - tmem_enabled = true; - return 1; -} -__setup("tmem", enable_tmem); -#endif #ifdef CONFIG_CLEANCACHE static int xen_tmem_destroy_pool(u32 pool_id) @@ -226,20 +261,6 @@ static int tmem_cleancache_init_shared_fs(char *uuid, size_t pagesize) return xen_tmem_new_pool(shared_uuid, TMEM_POOL_SHARED, pagesize); } -static bool disable_cleancache __read_mostly; -static bool disable_selfballooning __read_mostly; -#ifdef CONFIG_XEN_TMEM_MODULE -module_param(disable_cleancache, bool, S_IRUGO); -module_param(disable_selfballooning, bool, S_IRUGO); -#else -static int __init no_cleancache(char *s) -{ - disable_cleancache = true; - return 1; -} -__setup("nocleancache", no_cleancache); -#endif - static struct cleancache_ops tmem_cleancache_ops = { .put_page = tmem_cleancache_put_page, .get_page = tmem_cleancache_get_page, @@ -357,20 +378,6 @@ static void tmem_frontswap_init(unsigned ignored) xen_tmem_new_pool(private, TMEM_POOL_PERSIST, PAGE_SIZE); } -static bool disable_frontswap __read_mostly; -static bool disable_frontswap_selfshrinking __read_mostly; -#ifdef CONFIG_XEN_TMEM_MODULE -module_param(disable_frontswap, bool, S_IRUGO); -module_param(disable_frontswap_selfshrinking, bool, S_IRUGO); -#else -static int __init no_frontswap(char *s) -{ - disable_frontswap = true; - return 1; -} -__setup("nofrontswap", no_frontswap); -#endif - static struct frontswap_ops tmem_frontswap_ops = { .store = tmem_frontswap_store, .load = tmem_frontswap_load, @@ -378,8 +385,6 @@ static struct frontswap_ops tmem_frontswap_ops = { .invalidate_area = tmem_frontswap_flush_area, .init = tmem_frontswap_init }; -#else /* CONFIG_FRONTSWAP */ -#define disable_frontswap_selfshrinking 1 #endif static int xen_tmem_init(void) -- cgit v1.2.1 From e8f9cb034b1cb633ff920ec65381a2e7ac1d76f2 Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Wed, 8 May 2013 15:58:06 -0400 Subject: xen/tmem: Split out the different module/boot options. There are three options - depending on what combination of CONFIG_FRONTSWAP, CONFIG_CLEANCACHE and CONFIG_XEN_SELFBALLOONING is used. Lets split them out nicely out in three groups to make it easier to clean up. Signed-off-by: Konrad Rzeszutek Wilk --- drivers/xen/tmem.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c index edf7e18a1c05..c2ee1887806a 100644 --- a/drivers/xen/tmem.c +++ b/drivers/xen/tmem.c @@ -49,10 +49,8 @@ __setup("nocleancache", no_cleancache); #ifdef CONFIG_FRONTSWAP static bool disable_frontswap __read_mostly; -static bool disable_frontswap_selfshrinking __read_mostly; #ifdef CONFIG_XEN_TMEM_MODULE module_param(disable_frontswap, bool, S_IRUGO); -module_param(disable_frontswap_selfshrinking, bool, S_IRUGO); #else static int __init no_frontswap(char *s) { @@ -61,8 +59,15 @@ static int __init no_frontswap(char *s) } __setup("nofrontswap", no_frontswap); #endif -#else /* CONFIG_FRONTSWAP */ +#endif /* CONFIG_FRONTSWAP */ + +#ifdef CONFIG_FRONTSWAP +static bool disable_frontswap_selfshrinking __read_mostly; +#ifdef CONFIG_XEN_TMEM_MODULE +module_param(disable_frontswap_selfshrinking, bool, S_IRUGO); +#else #define disable_frontswap_selfshrinking 1 +#endif #endif /* CONFIG_FRONTSWAP */ #define TMEM_CONTROL 0 -- cgit v1.2.1 From 23972c639980ba796a05ae9432df8267175b99ae Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Wed, 8 May 2013 16:57:35 -0400 Subject: xen/tmem: Fix compile warning. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We keep on getting: drivers/xen/tmem.c:65:13: warning: ‘disable_frontswap_selfshrinking’ defined but not used [-Wunused-variable] if CONFIG_FRONTSWAP=y and # CONFIG_CLEANCACHE is not set Found by 0 day test project Reported-by: Fengguang Wu Signed-off-by: Konrad Rzeszutek Wilk --- drivers/xen/tmem.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c index c2ee1887806a..30bf97475e13 100644 --- a/drivers/xen/tmem.c +++ b/drivers/xen/tmem.c @@ -61,14 +61,12 @@ __setup("nofrontswap", no_frontswap); #endif #endif /* CONFIG_FRONTSWAP */ -#ifdef CONFIG_FRONTSWAP +#ifdef CONFIG_XEN_SELFBALLOONING static bool disable_frontswap_selfshrinking __read_mostly; #ifdef CONFIG_XEN_TMEM_MODULE module_param(disable_frontswap_selfshrinking, bool, S_IRUGO); -#else -#define disable_frontswap_selfshrinking 1 #endif -#endif /* CONFIG_FRONTSWAP */ +#endif /* CONFIG_XEN_SELFBALLOONING */ #define TMEM_CONTROL 0 #define TMEM_NEW_POOL 1 -- cgit v1.2.1 From 9fd19653faceef210f30901f7cee0ceb13c6f39a Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Wed, 8 May 2013 17:10:08 -0400 Subject: xen/tmem: s/disable_// and change the logic. The variety of disable_[cleancache|frontswap|selfshrinking] are making this a bit complex. Just remove the "disable_" part and change the logic around for the "nofrontswap" and "nocleancache" parameters. Signed-off-by: Konrad Rzeszutek Wilk --- drivers/xen/tmem.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c index 30bf97475e13..411c7e3df46c 100644 --- a/drivers/xen/tmem.c +++ b/drivers/xen/tmem.c @@ -32,15 +32,15 @@ __setup("tmem", enable_tmem); #endif #ifdef CONFIG_CLEANCACHE -static bool disable_cleancache __read_mostly; -static bool disable_selfballooning __read_mostly; +static bool cleancache __read_mostly = true; +static bool selfballooning __read_mostly = true; #ifdef CONFIG_XEN_TMEM_MODULE -module_param(disable_cleancache, bool, S_IRUGO); -module_param(disable_selfballooning, bool, S_IRUGO); +module_param(cleancache, bool, S_IRUGO); +module_param(selfballooning, bool, S_IRUGO); #else static int __init no_cleancache(char *s) { - disable_cleancache = true; + cleancache = false; return 1; } __setup("nocleancache", no_cleancache); @@ -48,13 +48,13 @@ __setup("nocleancache", no_cleancache); #endif /* CONFIG_CLEANCACHE */ #ifdef CONFIG_FRONTSWAP -static bool disable_frontswap __read_mostly; +static bool frontswap __read_mostly = true; #ifdef CONFIG_XEN_TMEM_MODULE -module_param(disable_frontswap, bool, S_IRUGO); +module_param(frontswap, bool, S_IRUGO); #else static int __init no_frontswap(char *s) { - disable_frontswap = true; + frontswap = false; return 1; } __setup("nofrontswap", no_frontswap); @@ -62,9 +62,9 @@ __setup("nofrontswap", no_frontswap); #endif /* CONFIG_FRONTSWAP */ #ifdef CONFIG_XEN_SELFBALLOONING -static bool disable_frontswap_selfshrinking __read_mostly; +static bool frontswap_selfshrinking __read_mostly = true; #ifdef CONFIG_XEN_TMEM_MODULE -module_param(disable_frontswap_selfshrinking, bool, S_IRUGO); +module_param(frontswap_selfshrinking, bool, S_IRUGO); #endif #endif /* CONFIG_XEN_SELFBALLOONING */ @@ -395,7 +395,7 @@ static int xen_tmem_init(void) if (!xen_domain()) return 0; #ifdef CONFIG_FRONTSWAP - if (tmem_enabled && !disable_frontswap) { + if (tmem_enabled && frontswap) { char *s = ""; struct frontswap_ops *old_ops = frontswap_register_ops(&tmem_frontswap_ops); @@ -412,7 +412,7 @@ static int xen_tmem_init(void) #endif #ifdef CONFIG_CLEANCACHE BUG_ON(sizeof(struct cleancache_filekey) != sizeof(struct tmem_oid)); - if (tmem_enabled && !disable_cleancache) { + if (tmem_enabled && cleancache) { char *s = ""; struct cleancache_ops *old_ops = cleancache_register_ops(&tmem_cleancache_ops); @@ -423,8 +423,7 @@ static int xen_tmem_init(void) } #endif #ifdef CONFIG_XEN_SELFBALLOONING - xen_selfballoon_init(!disable_selfballooning, - !disable_frontswap_selfshrinking); + xen_selfballoon_init(selfballooning, frontswap_selfshrinking); #endif return 0; } -- cgit v1.2.1 From 2ca62b044457e3aacaa06684974b0ff40b2f5a94 Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Wed, 8 May 2013 17:12:44 -0400 Subject: xen/tmem: Remove the boot options and fold them in the tmem.X parameters. If tmem is built-in or a module, the user has the option on the command line to influence it by doing: tmem. instead of having a variety of "nocleancache", and "nofrontswap". The others: "noselfballooning" and "selfballooning"; and "noselfshrink" are in a different driver xen-selfballoon.c and the patches: xen/tmem: Remove the usage of 'noselfshrink' and use 'tmem.selfshrink' bool instead. xen/tmem: Remove the usage of 'noselfballoon','selfballoon' and use 'tmem.selfballon' bool instead. remove them. Also add documentation. Signed-off-by: Konrad Rzeszutek Wilk --- Documentation/kernel-parameters.txt | 20 ++++++++++++++++++++ drivers/xen/tmem.c | 28 ++++------------------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index c3bfacb92910..3de01edca3ea 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -3005,6 +3005,26 @@ bytes respectively. Such letter suffixes can also be entirely omitted. Force threading of all interrupt handlers except those marked explicitly IRQF_NO_THREAD. + tmem [KNL,XEN] + Enable the Transcendent memory driver if built-in. + + tmem.cleancache=0|1 [KNL, XEN] + Default is on (1). Disable the usage of the cleancache + API to send anonymous pages to the hypervisor. + + tmem.frontswap=0|1 [KNL, XEN] + Default is on (1). Disable the usage of the frontswap + API to send swap pages to the hypervisor. + + tmem.selfballooning=0|1 [KNL, XEN] + Default is on (1). Disable the driving of swap pages + to the hypervisor. + + tmem.selfshrinking=0|1 [KNL, XEN] + Default is on (1). Partial swapoff that immediately + transfers pages from Xen hypervisor back to the + kernel based on different criteria. + topology= [S390] Format: {off | on} Specify if the kernel should make use of the cpu diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c index 411c7e3df46c..c1df0ff89878 100644 --- a/drivers/xen/tmem.c +++ b/drivers/xen/tmem.c @@ -33,39 +33,19 @@ __setup("tmem", enable_tmem); #ifdef CONFIG_CLEANCACHE static bool cleancache __read_mostly = true; -static bool selfballooning __read_mostly = true; -#ifdef CONFIG_XEN_TMEM_MODULE module_param(cleancache, bool, S_IRUGO); +static bool selfballooning __read_mostly = true; module_param(selfballooning, bool, S_IRUGO); -#else -static int __init no_cleancache(char *s) -{ - cleancache = false; - return 1; -} -__setup("nocleancache", no_cleancache); -#endif #endif /* CONFIG_CLEANCACHE */ #ifdef CONFIG_FRONTSWAP static bool frontswap __read_mostly = true; -#ifdef CONFIG_XEN_TMEM_MODULE module_param(frontswap, bool, S_IRUGO); -#else -static int __init no_frontswap(char *s) -{ - frontswap = false; - return 1; -} -__setup("nofrontswap", no_frontswap); -#endif #endif /* CONFIG_FRONTSWAP */ #ifdef CONFIG_XEN_SELFBALLOONING -static bool frontswap_selfshrinking __read_mostly = true; -#ifdef CONFIG_XEN_TMEM_MODULE -module_param(frontswap_selfshrinking, bool, S_IRUGO); -#endif +static bool selfshrinking __read_mostly = true; +module_param(selfshrinking, bool, S_IRUGO); #endif /* CONFIG_XEN_SELFBALLOONING */ #define TMEM_CONTROL 0 @@ -423,7 +403,7 @@ static int xen_tmem_init(void) } #endif #ifdef CONFIG_XEN_SELFBALLOONING - xen_selfballoon_init(selfballooning, frontswap_selfshrinking); + xen_selfballoon_init(selfballooning, selfshrinking); #endif return 0; } -- cgit v1.2.1 From 54598d1b034624dc0817fca3f2c7fd914938b7c8 Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Wed, 8 May 2013 16:44:06 -0400 Subject: xen/tmem: Remove the usage of 'noselfshrink' and use 'tmem.selfshrink' bool instead. As the 'tmem' driver is the one that actually sets whether it will use it or not so might as well make tmem responsible for this knob. Signed-off-by: Konrad Rzeszutek Wilk --- drivers/xen/Kconfig | 2 +- drivers/xen/xen-selfballoon.c | 15 ++------------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index f03bf501527f..98e9744e3359 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig @@ -22,7 +22,7 @@ config XEN_SELFBALLOONING ballooning is disabled by default but can be enabled with the 'selfballooning' kernel boot parameter. If FRONTSWAP is configured, frontswap-selfshrinking is enabled by default but can be disabled - with the 'noselfshrink' kernel boot parameter; and self-ballooning + with the 'tmem.selfshrink=0' kernel boot parameter; and self-ballooning is enabled by default but can be disabled with the 'noselfballooning' kernel boot parameter. Note that systems without a sufficiently large swap device should not enable self-ballooning. diff --git a/drivers/xen/xen-selfballoon.c b/drivers/xen/xen-selfballoon.c index f2ef569c7cc1..012f9d9bf5f4 100644 --- a/drivers/xen/xen-selfballoon.c +++ b/drivers/xen/xen-selfballoon.c @@ -60,8 +60,8 @@ * be enabled with the "selfballooning" kernel boot option; similarly * selfballooning is enabled by default if frontswap is configured and * can be disabled with the "noselfballooning" kernel boot option. Finally, - * when frontswap is configured, frontswap-selfshrinking can be disabled - * with the "noselfshrink" kernel boot option. + * when frontswap is configured,frontswap-selfshrinking can be disabled + * with the "tmem.selfshrink=0" kernel boot option. * * Selfballooning is disallowed in domain0 and force-disabled. * @@ -120,9 +120,6 @@ static DECLARE_DELAYED_WORK(selfballoon_worker, selfballoon_process); /* Enable/disable with sysfs. */ static bool frontswap_selfshrinking __read_mostly; -/* Enable/disable with kernel boot option. */ -static bool use_frontswap_selfshrink = true; - /* * The default values for the following parameters were deemed reasonable * by experimentation, may be workload-dependent, and can all be @@ -176,14 +173,6 @@ static void frontswap_selfshrink(void) frontswap_shrink(tgt_frontswap_pages); } -static int __init xen_nofrontswap_selfshrink_setup(char *s) -{ - use_frontswap_selfshrink = false; - return 1; -} - -__setup("noselfshrink", xen_nofrontswap_selfshrink_setup); - /* Disable with kernel boot option. */ static bool use_selfballooning = true; -- cgit v1.2.1 From ed4f346a008edda8ee08ffcdc642691847636954 Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Wed, 8 May 2013 16:52:38 -0400 Subject: xen/tmem: Remove the usage of '[no|]selfballoon' and use 'tmem.selfballooning' bool instead. As the 'tmem' driver is the one that actually sets whether it will use it (or not) so might as well make tmem responsible for this knob. Signed-off-by: Konrad Rzeszutek Wilk --- drivers/xen/Kconfig | 5 ++--- drivers/xen/xen-selfballoon.c | 25 ++----------------------- 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index 98e9744e3359..9e02d60a364b 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig @@ -19,11 +19,10 @@ config XEN_SELFBALLOONING by the current usage of anonymous memory ("committed AS") and controlled by various sysfs-settable parameters. Configuring FRONTSWAP is highly recommended; if it is not configured, self- - ballooning is disabled by default but can be enabled with the - 'selfballooning' kernel boot parameter. If FRONTSWAP is configured, + ballooning is disabled by default. If FRONTSWAP is configured, frontswap-selfshrinking is enabled by default but can be disabled with the 'tmem.selfshrink=0' kernel boot parameter; and self-ballooning - is enabled by default but can be disabled with the 'noselfballooning' + is enabled by default but can be disabled with the 'tmem.selfballooning=0' kernel boot parameter. Note that systems without a sufficiently large swap device should not enable self-ballooning. diff --git a/drivers/xen/xen-selfballoon.c b/drivers/xen/xen-selfballoon.c index 012f9d9bf5f4..5d637e2b1b9f 100644 --- a/drivers/xen/xen-selfballoon.c +++ b/drivers/xen/xen-selfballoon.c @@ -57,9 +57,9 @@ * configured, it is highly recommended that frontswap also be configured * and enabled when selfballooning is running. So, selfballooning * is disabled by default if frontswap is not configured and can only - * be enabled with the "selfballooning" kernel boot option; similarly + * be enabled with the "tmem.selfballooning=1" kernel boot option; similarly * selfballooning is enabled by default if frontswap is configured and - * can be disabled with the "noselfballooning" kernel boot option. Finally, + * can be disabled with the "tmem.selfballooning=0" kernel boot option. Finally, * when frontswap is configured,frontswap-selfshrinking can be disabled * with the "tmem.selfshrink=0" kernel boot option. * @@ -173,27 +173,6 @@ static void frontswap_selfshrink(void) frontswap_shrink(tgt_frontswap_pages); } -/* Disable with kernel boot option. */ -static bool use_selfballooning = true; - -static int __init xen_noselfballooning_setup(char *s) -{ - use_selfballooning = false; - return 1; -} - -__setup("noselfballooning", xen_noselfballooning_setup); -#else /* !CONFIG_FRONTSWAP */ -/* Enable with kernel boot option. */ -static bool use_selfballooning; - -static int __init xen_selfballooning_setup(char *s) -{ - use_selfballooning = true; - return 1; -} - -__setup("selfballooning", xen_selfballooning_setup); #endif /* CONFIG_FRONTSWAP */ #define MB2PAGES(mb) ((mb) << (20 - PAGE_SHIFT)) -- cgit v1.2.1 From 37d46e152e4c71cd772085912f1c7bf06839f739 Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Tue, 14 May 2013 13:56:42 -0400 Subject: xen/tmem: Don't use self[ballooning|shrinking] if frontswap is off. There is no point. We would just squeeze the guest to put more and more pages in the swap disk without any purpose. The only time it makes sense to use the selfballooning and shrinking is when frontswap is being utilized. Signed-off-by: Konrad Rzeszutek Wilk --- Documentation/kernel-parameters.txt | 3 ++- drivers/xen/tmem.c | 8 ++++++++ drivers/xen/xen-selfballoon.c | 15 ++++++--------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 3de01edca3ea..6e3b18a8afc6 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -3014,7 +3014,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted. tmem.frontswap=0|1 [KNL, XEN] Default is on (1). Disable the usage of the frontswap - API to send swap pages to the hypervisor. + API to send swap pages to the hypervisor. If disabled + the selfballooning and selfshrinking are force disabled. tmem.selfballooning=0|1 [KNL, XEN] Default is on (1). Disable the driving of swap pages diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c index c1df0ff89878..18e8bd8fa947 100644 --- a/drivers/xen/tmem.c +++ b/drivers/xen/tmem.c @@ -403,6 +403,14 @@ static int xen_tmem_init(void) } #endif #ifdef CONFIG_XEN_SELFBALLOONING + /* + * There is no point of driving pages to the swap system if they + * aren't going anywhere in tmem universe. + */ + if (!frontswap) { + selfshrinking = false; + selfballooning = false; + } xen_selfballoon_init(selfballooning, selfshrinking); #endif return 0; diff --git a/drivers/xen/xen-selfballoon.c b/drivers/xen/xen-selfballoon.c index 5d637e2b1b9f..f70984a892aa 100644 --- a/drivers/xen/xen-selfballoon.c +++ b/drivers/xen/xen-selfballoon.c @@ -53,15 +53,12 @@ * System configuration note: Selfballooning should not be enabled on * systems without a sufficiently large swap device configured; for best * results, it is recommended that total swap be increased by the size - * of the guest memory. Also, while technically not required to be - * configured, it is highly recommended that frontswap also be configured - * and enabled when selfballooning is running. So, selfballooning - * is disabled by default if frontswap is not configured and can only - * be enabled with the "tmem.selfballooning=1" kernel boot option; similarly - * selfballooning is enabled by default if frontswap is configured and - * can be disabled with the "tmem.selfballooning=0" kernel boot option. Finally, - * when frontswap is configured,frontswap-selfshrinking can be disabled - * with the "tmem.selfshrink=0" kernel boot option. + * of the guest memory. Note, that selfballooning should be disabled by default + * if frontswap is not configured. Similarly selfballooning should be enabled + * by default if frontswap is configured and can be disabled with the + * "tmem.selfballooning=0" kernel boot option. Finally, when frontswap is + * configured, frontswap-selfshrinking can be disabled with the + * "tmem.selfshrink=0" kernel boot option. * * Selfballooning is disallowed in domain0 and force-disabled. * -- cgit v1.2.1 From d7e5075044f6c4e85f671cb88f99187509f4a2b0 Mon Sep 17 00:00:00 2001 From: Lisa Nguyen Date: Wed, 15 May 2013 23:47:11 -0700 Subject: xen/xenbus: Fixed indentation error in switch case Fixed the indentation error in the switch case in xenbus_dev_backend.c Signed-off-by: Lisa Nguyen Signed-off-by: Konrad Rzeszutek Wilk --- drivers/xen/xenbus/xenbus_dev_backend.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/xen/xenbus/xenbus_dev_backend.c b/drivers/xen/xenbus/xenbus_dev_backend.c index d73000800762..120ae159fdad 100644 --- a/drivers/xen/xenbus/xenbus_dev_backend.c +++ b/drivers/xen/xenbus/xenbus_dev_backend.c @@ -76,16 +76,14 @@ static long xenbus_backend_ioctl(struct file *file, unsigned int cmd, unsigned l return -EPERM; switch (cmd) { - case IOCTL_XENBUS_BACKEND_EVTCHN: - if (xen_store_evtchn > 0) - return xen_store_evtchn; - return -ENODEV; - - case IOCTL_XENBUS_BACKEND_SETUP: - return xenbus_alloc(data); - - default: - return -ENOTTY; + case IOCTL_XENBUS_BACKEND_EVTCHN: + if (xen_store_evtchn > 0) + return xen_store_evtchn; + return -ENODEV; + case IOCTL_XENBUS_BACKEND_SETUP: + return xenbus_alloc(data); + default: + return -ENOTTY; } } -- cgit v1.2.1 From 3d645b02d9c6254caf51d9d78e6d9caf72990b33 Mon Sep 17 00:00:00 2001 From: Lisa Nguyen Date: Wed, 15 May 2013 23:48:03 -0700 Subject: xen/xenbus: Fixed over 80 character limit issue Fixed the format length of the xenbus_backend_ioctl() function to meet the 80 character limit in xenbus_dev_backend.c Signed-off-by: Lisa Nguyen Signed-off-by: Konrad Rzeszutek Wilk --- drivers/xen/xenbus/xenbus_dev_backend.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/xen/xenbus/xenbus_dev_backend.c b/drivers/xen/xenbus/xenbus_dev_backend.c index 120ae159fdad..a6f42fc01407 100644 --- a/drivers/xen/xenbus/xenbus_dev_backend.c +++ b/drivers/xen/xenbus/xenbus_dev_backend.c @@ -70,7 +70,8 @@ static long xenbus_alloc(domid_t domid) return err; } -static long xenbus_backend_ioctl(struct file *file, unsigned int cmd, unsigned long data) +static long xenbus_backend_ioctl(struct file *file, unsigned int cmd, + unsigned long data) { if (!capable(CAP_SYS_ADMIN)) return -EPERM; -- cgit v1.2.1 From fce92683570c2ddcdb82cde67b0b07800106fbd9 Mon Sep 17 00:00:00 2001 From: Lisa Nguyen Date: Wed, 15 May 2013 22:59:40 -0700 Subject: xen: Fixed assignment error in if statement Fixed assignment error in if statement in balloon.c Signed-off-by: Lisa Nguyen Signed-off-by: Konrad Rzeszutek Wilk --- drivers/xen/balloon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) nr_pages = ARRAY_SIZE(frame_list); for (i = 0; i < nr_pages; i++) { - if ((page = alloc_page(gfp)) == NULL) { + page = alloc_page(gfp); + if (page == NULL) { nr_pages = i; state = BP_EAGAIN; break; -- cgit v1.2.1