[Devel] [PATCH RHEL7 COMMIT] mm/tcache: change API to conform to tswap

Konstantin Khorenko khorenko at odin.com
Tue Apr 28 05:49:57 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear on ssh://git@git.sw.ru/vzs/vzkernel.git
after rh7-3.10.0-123.1.2.el7.ovz.4.8
------>
commit 21c8fbe7ffe311f2d830065273a475a61a3b3600
Author: Vladimir Davydov <vdavydov at parallels.com>
Date:   Tue Apr 28 16:48:56 2015 +0400

    mm/tcache: change API to conform to tswap
    
    Since tswap cannot be built as a module, let us forbid building tcache
    as a module too. Now the API looks like:
    
     - To enable the cleancache backend, pass tcache.enabled=1 at boot
     - To activate/deactivate tcache, write Y/N to
       /sys/module/tcache/parameters/active
    
    https://jira.sw.ru/browse/PSBM-31915
    
    Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
 config.OpenVZ |  2 +-
 mm/Kconfig    |  2 +-
 mm/tcache.c   | 18 +++++++++++-------
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/config.OpenVZ b/config.OpenVZ
index 3df8b50..7275b27 100644
--- a/config.OpenVZ
+++ b/config.OpenVZ
@@ -5289,7 +5289,7 @@ CONFIG_MPILIB_EXTRA=y
 CONFIG_HAVE_ARCH_SOFT_DIRTY=y
 CONFIG_MEM_SOFT_DIRTY=y
 
-CONFIG_TCACHE=m
+CONFIG_TCACHE=y
 
 #
 # User resources
diff --git a/mm/Kconfig b/mm/Kconfig
index 7d17e35..d91c9a6 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -523,7 +523,7 @@ config MEM_SOFT_DIRTY
 	  See Documentation/vm/soft-dirty.txt for more details.
 
 config TCACHE
-	tristate "Transcendent file cache"
+	bool "Transcendent file cache"
 	depends on CLEANCACHE
 	default n
 	help
diff --git a/mm/tcache.c b/mm/tcache.c
index 88bf82a..bc740f0 100644
--- a/mm/tcache.c
+++ b/mm/tcache.c
@@ -124,9 +124,15 @@ static struct tcache_lru *tcache_lru_node;
  * - tcache_lru->lock is independent
  */
 
-/* Enable/disable populating the cache */
+/* Enable/disable tcache backend (set at boot time) */
 static bool tcache_enabled __read_mostly;
+module_param_named(enabled, tcache_enabled, bool, 0444);
+
+/* Enable/disable populating the cache */
+static bool tcache_active __read_mostly;
+module_param_named(active, tcache_active, bool, 0644);
 
+/* Total number of pages cached */
 static DEFINE_PER_CPU(long, nr_tcache_pages);
 
 static inline u32 key_hash(const struct cleancache_filekey *key)
@@ -831,7 +837,7 @@ static void tcache_cleancache_put_page(int pool_id,
 	struct tcache_node *node;
 	struct page *cache_page;
 
-	if (!tcache_enabled)
+	if (!tcache_active)
 		return;
 
 	cache_page = tcache_alloc_page();
@@ -928,12 +934,7 @@ static int param_get_nr_pages(char *buffer, const struct kernel_param *kp)
 static struct kernel_param_ops param_ops_nr_pages = {
 	.get = param_get_nr_pages,
 };
-
-module_param_named(enabled, tcache_enabled, bool, 0644);
-MODULE_PARM_DESC(enabled, "Activate/deactivate tcache");
-
 module_param_cb(nr_pages, &param_ops_nr_pages, NULL, 0444);
-MODULE_PARM_DESC(nr_pages, "Number of pages cached");
 
 static int __init tcache_lru_init(void)
 {
@@ -955,6 +956,9 @@ static int __init tcache_init(void)
 {
 	int err;
 
+	if (!tcache_enabled)
+		return 0;
+
 	err = tcache_lru_init();
 	if (err)
 		goto out_fail;



More information about the Devel mailing list