2013-05-14 18:20:45

by Konrad Rzeszutek Wilk

[permalink] [raw]
Subject: [PATCH] Fixes, cleanups, compile warning fixes, and documentation update for Xen tmem driver (v2).

Heya,

These nine patches fix the tmem driver to:
- not emit a compile warning anymore (reported by 0 day test compile tool)
- remove the various nofrontswap, nocleancache, noselfshrinking, noselfballooning,
selfballooning, selfshrinking bootup options.
- said options are now folded in the tmem driver as module options and are
much shorter (and also there are only four of them now).
- add documentation to explain these parameters in kernel-parameters.txt
- And lastly add some logic to not enable selfshrinking and selfballooning
if frontswap functionality is off.

That is it. Tested and ready to go. If nobody objects will put on my queue
for Linus on Monday.

Documentation/kernel-parameters.txt | 21 ++++++++
drivers/xen/Kconfig | 7 +--
drivers/xen/tmem.c | 87 ++++++++++++++++-------------------
drivers/xen/xen-selfballoon.c | 47 ++----------------
4 files changed, 69 insertions(+), 93 deletions(-)

(oh nice, more deletions!)

Konrad Rzeszutek Wilk (9):
xen/tmem: Cleanup. Remove the parts that say temporary.
xen/tmem: Move all of the boot and module parameters to the top of the file.
xen/tmem: Split out the different module/boot options.
xen/tmem: Fix compile warning.
xen/tmem: s/disable_// and change the logic.
xen/tmem: Remove the boot options and fold them in the tmem.X parameters.
xen/tmem: Remove the usage of 'noselfshrink' and use 'tmem.selfshrink' bool instead.
xen/tmem: Remove the usage of '[no|]selfballoon' and use 'tmem.selfballooning' bool instead.
xen/tmem: Don't use self[ballooning|shrinking] if frontswap is off.


2013-05-14 18:20:49

by Konrad Rzeszutek Wilk

[permalink] [raw]
Subject: [PATCH 2/9] 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 <[email protected]>
---
drivers/xen/tmem.c | 85 +++++++++++++++++++++++++++------------------------
1 files changed, 45 insertions(+), 40 deletions(-)

diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c
index 5686d6d..edf7e18 100644
--- a/drivers/xen/tmem.c
+++ b/drivers/xen/tmem.c
@@ -20,6 +20,51 @@
#include <asm/xen/hypervisor.h>
#include <xen/tmem.h>

+#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)
--
1.7.7.6

2013-05-14 18:20:56

by Konrad Rzeszutek Wilk

[permalink] [raw]
Subject: [PATCH 8/9] 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 <[email protected]>
---
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 98e9744..9e02d60 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 012f9d9..5d637e2 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))
--
1.7.7.6

2013-05-14 18:20:53

by Konrad Rzeszutek Wilk

[permalink] [raw]
Subject: [PATCH 5/9] 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 <[email protected]>
---
drivers/xen/tmem.c | 27 +++++++++++++--------------
1 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c
index 30bf974..411c7e3 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;
}
--
1.7.7.6

2013-05-14 18:21:10

by Konrad Rzeszutek Wilk

[permalink] [raw]
Subject: [PATCH 9/9] 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 <[email protected]>
---
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 3de01ed..6e3b18a 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 c1df0ff..18e8bd8 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 5d637e2..f70984a8 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.
*
--
1.7.7.6

2013-05-14 18:21:38

by Konrad Rzeszutek Wilk

[permalink] [raw]
Subject: [PATCH 7/9] 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 <[email protected]>
---
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 f03bf50..98e9744 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 f2ef569..012f9d9 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;

--
1.7.7.6

2013-05-14 18:21:53

by Konrad Rzeszutek Wilk

[permalink] [raw]
Subject: [PATCH 6/9] 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.<some option>
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.

removes them.

Also add documentation.

Signed-off-by: Konrad Rzeszutek Wilk <[email protected]>
---
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 c3bfacb..3de01ed 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 411c7e3..c1df0ff 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;
}
--
1.7.7.6

2013-05-14 18:22:13

by Konrad Rzeszutek Wilk

[permalink] [raw]
Subject: [PATCH 4/9] xen/tmem: Fix compile warning.

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 <[email protected]>
Signed-off-by: Konrad Rzeszutek Wilk <[email protected]>
---
drivers/xen/tmem.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c
index c2ee188..30bf974 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
--
1.7.7.6

2013-05-14 18:20:47

by Konrad Rzeszutek Wilk

[permalink] [raw]
Subject: [PATCH 1/9] xen/tmem: Cleanup. Remove the parts that say temporary.

Frontswap is upstream, not of having this #ifdef.

Signed-off-by: Konrad Rzeszutek Wilk <[email protected]>
---
drivers/xen/tmem.c | 4 ----
1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c
index e3600be..5686d6d 100644
--- a/drivers/xen/tmem.c
+++ b/drivers/xen/tmem.c
@@ -11,11 +11,7 @@
#include <linux/init.h>
#include <linux/pagemap.h>
#include <linux/cleancache.h>
-
-/* temporary ifdef until include/linux/frontswap.h is upstream */
-#ifdef CONFIG_FRONTSWAP
#include <linux/frontswap.h>
-#endif

#include <xen/xen.h>
#include <xen/interface/xen.h>
--
1.7.7.6

2013-05-14 18:22:47

by Konrad Rzeszutek Wilk

[permalink] [raw]
Subject: [PATCH 3/9] 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 <[email protected]>
---
drivers/xen/tmem.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/xen/tmem.c b/drivers/xen/tmem.c
index edf7e18..c2ee188 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
--
1.7.7.6

2013-05-15 17:22:28

by Dan Magenheimer

[permalink] [raw]
Subject: RE: [PATCH] Fixes, cleanups, compile warning fixes, and documentation update for Xen tmem driver (v2).

> From: Konrad Rzeszutek [mailto:[email protected]] On Behalf Of Konrad Rzeszutek Wilk
> Sent: Tuesday, May 14, 2013 12:09 PM
> To: [email protected]; [email protected]; [email protected]; akpm@linux-
> foundation.org; [email protected]; [email protected]
> Subject: [PATCH] Fixes, cleanups, compile warning fixes, and documentation update for Xen tmem driver
> (v2).
>
> Heya,
>
> These nine patches fix the tmem driver to:
> - not emit a compile warning anymore (reported by 0 day test compile tool)
> - remove the various nofrontswap, nocleancache, noselfshrinking, noselfballooning,
> selfballooning, selfshrinking bootup options.
> - said options are now folded in the tmem driver as module options and are
> much shorter (and also there are only four of them now).
> - add documentation to explain these parameters in kernel-parameters.txt
> - And lastly add some logic to not enable selfshrinking and selfballooning
> if frontswap functionality is off.
>
> That is it. Tested and ready to go. If nobody objects will put on my queue
> for Linus on Monday.

FWIW, I've scanned all of these and they look sane and good. So consider all:

Acked-by: Dan Magenheimer <[email protected]>

> Documentation/kernel-parameters.txt | 21 ++++++++
> drivers/xen/Kconfig | 7 +--
> drivers/xen/tmem.c | 87 ++++++++++++++++-------------------
> drivers/xen/xen-selfballoon.c | 47 ++----------------
> 4 files changed, 69 insertions(+), 93 deletions(-)
>
> (oh nice, more deletions!)
>
> Konrad Rzeszutek Wilk (9):
> xen/tmem: Cleanup. Remove the parts that say temporary.
> xen/tmem: Move all of the boot and module parameters to the top of the file.
> xen/tmem: Split out the different module/boot options.
> xen/tmem: Fix compile warning.
> xen/tmem: s/disable_// and change the logic.
> xen/tmem: Remove the boot options and fold them in the tmem.X parameters.
> xen/tmem: Remove the usage of 'noselfshrink' and use 'tmem.selfshrink' bool instead.
> xen/tmem: Remove the usage of '[no|]selfballoon' and use 'tmem.selfballooning' bool instead.
> xen/tmem: Don't use self[ballooning|shrinking] if frontswap is off.