From patchwork Thu Jul 6 06:39:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13303229 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3300CEB64D9 for ; Thu, 6 Jul 2023 06:39:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8E99E8D0002; Thu, 6 Jul 2023 02:39:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 871A28D0001; Thu, 6 Jul 2023 02:39:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 739568D0002; Thu, 6 Jul 2023 02:39:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 60D838D0001 for ; Thu, 6 Jul 2023 02:39:01 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 340CD40206 for ; Thu, 6 Jul 2023 06:39:01 +0000 (UTC) X-FDA: 80980234482.20.F9F9DD1 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf28.hostedemail.com (Postfix) with ESMTP id A051BC0019 for ; Thu, 6 Jul 2023 06:38:57 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf28.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1688625538; a=rsa-sha256; cv=none; b=W/FZUvUDX59agyWj8j+YPNaGbFKWgojY5/W1Fy1NM6djAB8OgL0NW0cbWUzBnkXJK5yNcF bEMlaiHbrba/Xs5eF8ClJAt5odatP/eIK7bsFA8BGAPtqjoBVYpA6EQz0yrNW2VzLQbBLF xXptfK2F/cSBZyv8iM8UwkFUBqmwZ2o= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf28.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1688625538; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=IS7J96lesB3WxKUWfHl7ZXU+I6K4mby+GeyJRSBP4Pc=; b=bO7ll0kSAZq0A4Ab9pNkmsBQ2DcDDB9uoR2Rs4Er/Ff6cuetnk0+8B+UT1XlZRYwMm8W8E oHP9PvqKpQeIsW20kyjQpxrRYX57hVJVGUS7nv0ioY7giHevOaZ16qZKxQvyvNfViXErvS fZ+P4wmNuqI2bm953m8bFCJ/855QX98= Received: from canpemm500002.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4QxRdF3rm2zPjxF; Thu, 6 Jul 2023 14:36:33 +0800 (CST) Received: from huawei.com (10.174.151.185) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 6 Jul 2023 14:38:46 +0800 From: Miaohe Lin To: , , , CC: , , , , , Subject: [PATCH] memory tier: rename destroy_memory_type() to put_memory_type() Date: Thu, 6 Jul 2023 14:39:05 +0800 Message-ID: <20230706063905.543800-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-Originating-IP: [10.174.151.185] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: A051BC0019 X-Stat-Signature: 64bygjoawh4c7m5de9yanip6gs8emu35 X-Rspam-User: X-HE-Tag: 1688625537-494704 X-HE-Meta: U2FsdGVkX19GUQKE5LWT5rxSRx/fB3iM3HslEt1ZmLAjBgQvK5QcJRFsKzpvxvnOtztpzhH60zWs7T6lGm8r7mRu9JCuAsbX2ZFlnR5N4PiW9LAI77y66iI4zoiKWbAeuVQHMNAbXdi7GexHrdHU/KQqtYoiyBrZ0yx/QPOtq/9UL9NVAFtngrPon6r9Su7DDYD+WxlaC1h0m+gCYRuS5bG8oi8P0Q7nxxaot7QrC1WLUdoygNm2rcq+3IG45rDhF4qkOf8vxYOYTY+kzOd5crQqKiv5vvRPcWo/wJaPLJRSjcB5OB0+NNSvbg1WuBGUn7qK4SYxC80wrxVWnGMEik37p7tkq7tQavOnrNx1nQI+n00kZcTBvyYkh+Z0i8ElXLiU7q5oUCu09tZDEvBDFWl6ZPnviFkOwBwXSRSiIC3X8LjZlpV8iicYQTf5P8JaU9I9dnAjlngjBd9I63EcWUDVDwW3usohyBcCeRcbbmNOQ5Lur/Ovd1/ukh5YwebCXnqJyKspEenrVFn/uaApo2iFrcK16MTleYuvXORGTUAL3vRD35aeUKX4yDAnWRtxru61Cg0VWBOoHf/SLeSSSUi5JHpmDqFZtb3FtlVPInUfnsfFC3NeRfA/xlrGREd6GTQ3oAIwGmZ2S7B4ZLVi+KoheJBXaXUkws/fnZ3i/wl5Ho+Ixu+NGooblheYhE5fGo3zn47jdxjtYrgLkW8dxzWA6OWaQ98zHRrkidQLxjpy78eh4NZ5m11BdDZ1iDCs6f603Vjm6LzVGixyhPXSCoTVa2OZoIlU6+8v/CqyfIezxxBTjj6hrrwvOv0P1pCxlomPK5ZJWnvzxG56wt8MbmSNLkdHfk1xaAqmMOJYp726xA9sX2iXp9Blw01HYfo6Sd3YcJjhR22PuAcerC8/OodNguWcKhVuq3wE54DMxheZZmMw7d9+ZvUyjQyQbWjPY5vjlYjSLDqfsWr+0Ar GuleJZdC F8z63PeYzodWrw7bUTye2EvvBaiwXzNUHavPIcLoi1a6WxzSqJcBA7KM0Znfc2jKDRS+nrfVcYs278pKIqlfZahD/IJNfgElVIw4NkOqXNfs7mStF3moedU5EL8gbL1BlCaTvhTMNtLVGBT04elNjjQ1xRXirmBHi6OYCxCNZsiq+YfgK8AR5Ew04o8PWKn3tYPouzAqM7MXJ/ejDEnkSb+SPig== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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(). Suggested-by: Huang, Ying Signed-off-by: Miaohe Lin Reviewed-by: "Huang, Ying" Reviewed-by: Xiao Yang --- drivers/dax/kmem.c | 4 ++-- include/linux/memory-tiers.h | 4 ++-- mm/memory-tiers.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c index 898ca9505754..c57acb73e3db 100644 --- a/drivers/dax/kmem.c +++ b/drivers/dax/kmem.c @@ -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"); diff --git a/include/linux/memory-tiers.h b/include/linux/memory-tiers.h index fc9647b1b4f9..437441cdf78f 100644 --- a/include/linux/memory-tiers.h +++ b/include/linux/memory-tiers.h @@ -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) { } diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c index 1719fa3bcf02..c49ab03f49b1 100644 --- a/mm/memory-tiers.c +++ b/mm/memory-tiers.c @@ -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); }