Re: [PATCH 1/2] mm/hugetlb: extract sysfs into hugetlb_sysfs.c
From: David Hildenbrand (Red Hat)
Date: Mon Nov 03 2025 - 11:37:28 EST
On 03.11.25 09:22, Hui Zhu wrote:
From: Geliang Tang <geliang@xxxxxxxxxx>
Currently, hugetlb.c contains both core management logic and sysfs
interface implementations, making it difficult to maintain. This patch
extracts the sysfs-related code into a dedicated file to improve code
organization.
The following components are moved to mm/hugetlb_sysfs.c:
- hugetlb page demote functions (demote_free_hugetlb_folios,
demote_pool_huge_page)
- sysfs attribute definitions and handlers
- sysfs kobject management functions
- NUMA per-node hstate attribute registration
Several inline helper functions and macros are moved to
mm/hugetlb_internal.h:
- hstate_is_gigantic_no_runtime()
- next_node_allowed()
- get_valid_node_allowed()
- hstate_next_node_to_alloc()
- hstate_next_node_to_free()
- for_each_node_mask_to_alloc/to_free macros
To support code sharing, these functions are changed from static to
exported symbols:
- remove_hugetlb_folio()
- add_hugetlb_folio()
- init_new_hugetlb_folio()
- prep_and_add_allocated_folios()
- __nr_hugepages_store_common()
The Makefile is updated to compile hugetlb_sysfs.o when
CONFIG_HUGETLBFS is enabled. This maintains all existing functionality
while improving maintainability by separating concerns.
Signed-off-by: Geliang Tang <geliang@xxxxxxxxxx>
Signed-off-by: Hui Zhu <zhuhui@xxxxxxxxxx>
---
[...]
index 000000000000..63ab13cfb072
--- /dev/null
+++ b/mm/hugetlb_internal.h
@@ -0,0 +1,110 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Internal HugeTLB definitions.
+ *
+ * Copyright (C) 2025 KylinSoft Corporation.
+ * Author: Geliang Tang <geliang@xxxxxxxxxx>
+ */
So, you move some code and suddenly have copyright and authored that code.
Especially given the cove letter says "The code is moved
as-is, with only minor formatting adjustments for code style
consistency."
?
--
Cheers
David