memory tier: rename destroy_memory_type() to put_memory_type()
authorMiaohe Lin <linmiaohe@huawei.com>
Thu, 6 Jul 2023 06:39:05 +0000 (14:39 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 18 Aug 2023 17:12:11 +0000 (10:12 -0700)
It appears that destroy_memory_type() isn't a very good name because we
usually will not free the memory_type here.  So rename it to a more
appropriate name i.e.  put_memory_type().

Link: https://lkml.kernel.org/r/20230706063905.543800-1-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Suggested-by: Huang, Ying <ying.huang@intel.com>
Reviewed-by: "Huang, Ying" <ying.huang@intel.com>
Reviewed-by: Xiao Yang <yangx.jy@fujitsu.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/dax/kmem.c
include/linux/memory-tiers.h
mm/memory-tiers.c

index 898ca95..c57acb7 100644 (file)
@@ -264,7 +264,7 @@ static int __init dax_kmem_init(void)
        return rc;
 
 error_dax_driver:
-       destroy_memory_type(dax_slowmem_type);
+       put_memory_type(dax_slowmem_type);
 err_dax_slowmem_type:
        kfree_const(kmem_name);
        return rc;
@@ -275,7 +275,7 @@ static void __exit dax_kmem_exit(void)
        dax_driver_unregister(&device_dax_kmem_driver);
        if (!any_hotremove_failed)
                kfree_const(kmem_name);
-       destroy_memory_type(dax_slowmem_type);
+       put_memory_type(dax_slowmem_type);
 }
 
 MODULE_AUTHOR("Intel Corporation");
index fc9647b..437441c 100644 (file)
@@ -33,7 +33,7 @@ struct memory_dev_type {
 #ifdef CONFIG_NUMA
 extern bool numa_demotion_enabled;
 struct memory_dev_type *alloc_memory_type(int adistance);
-void destroy_memory_type(struct memory_dev_type *memtype);
+void put_memory_type(struct memory_dev_type *memtype);
 void init_node_memory_type(int node, struct memory_dev_type *default_type);
 void clear_node_memory_type(int node, struct memory_dev_type *memtype);
 #ifdef CONFIG_MIGRATION
@@ -68,7 +68,7 @@ static inline struct memory_dev_type *alloc_memory_type(int adistance)
        return NULL;
 }
 
-static inline void destroy_memory_type(struct memory_dev_type *memtype)
+static inline void put_memory_type(struct memory_dev_type *memtype)
 {
 
 }
index 1719fa3..c49ab03 100644 (file)
@@ -560,11 +560,11 @@ struct memory_dev_type *alloc_memory_type(int adistance)
 }
 EXPORT_SYMBOL_GPL(alloc_memory_type);
 
-void destroy_memory_type(struct memory_dev_type *memtype)
+void put_memory_type(struct memory_dev_type *memtype)
 {
        kref_put(&memtype->kref, release_memtype);
 }
-EXPORT_SYMBOL_GPL(destroy_memory_type);
+EXPORT_SYMBOL_GPL(put_memory_type);
 
 void init_node_memory_type(int node, struct memory_dev_type *memtype)
 {
@@ -586,7 +586,7 @@ void clear_node_memory_type(int node, struct memory_dev_type *memtype)
         */
        if (!node_memory_types[node].map_count) {
                node_memory_types[node].memtype = NULL;
-               destroy_memory_type(memtype);
+               put_memory_type(memtype);
        }
        mutex_unlock(&memory_tier_lock);
 }