[RFC PATCH v2 02/22] fs/resctrl: Define the kernfs_ops as page-size variables
From: Eric Curtin
Date: Tue Dec 01 2026 - 22:16:00 EST
From: Eric Curtin <eric.curtin@xxxxxxxxxx>
With arm64 boot-time page size selection PAGE_SIZE is not a compile-time
constant, so it cannot initialise .atomic_write_len in a static const
struct kernfs_ops.
Define rdtgroup_kf_single_ops and kf_mondata_ops with
DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(), which keeps them const for fixed
page sizes and initialises them from the run-time PAGE_SIZE before any
initcall otherwise.
No functional change for compile-time page sizes.
Signed-off-by: Eric Curtin <eric.curtin@xxxxxxxxxx>
---
fs/resctrl/rdtgroup.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 57ab090072c2..68f45ee82ff8 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -329,16 +329,17 @@ static ssize_t rdtgroup_file_write(struct kernfs_open_file *of, char *buf,
return -EINVAL;
}
-static const struct kernfs_ops rdtgroup_kf_single_ops = {
+static DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(struct kernfs_ops,
+ rdtgroup_kf_single_ops, {
.atomic_write_len = PAGE_SIZE,
.write = rdtgroup_file_write,
.seq_show = rdtgroup_seqfile_show,
-};
+});
-static const struct kernfs_ops kf_mondata_ops = {
+static DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(struct kernfs_ops, kf_mondata_ops, {
.atomic_write_len = PAGE_SIZE,
.seq_show = rdtgroup_mondata_show,
-};
+});
static bool is_cpu_list(struct kernfs_open_file *of)
{