Linux cgroups development
 help / color / mirror / Atom feed
* [RFC PATCH v2 08/43] cgroup: Use DEFINE_GLOBAL_PAGE_SIZE_VAR for the kernfs_ops tables
       [not found] <20261201015240.1017259-1-ericcurtin17@gmail.com>
@ 2026-12-01  1:51 ` Eric Curtin
  0 siblings, 0 replies; only message in thread
From: Eric Curtin @ 2026-12-01  1:51 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Ryan Roberts, Tejun Heo, Johannes Weiner, Michal Koutný,
	cgroups

From: Ryan Roberts <ryan.roberts@arm.com>

cgroup_kf_single_ops and cgroup_kf_ops initialise .atomic_write_len with
PAGE_SIZE. With boot-time page size selection that is not a compile-time
constant, so it cannot be used in a static initialiser.

Define both tables with DEFINE_GLOBAL_PAGE_SIZE_VAR() so that, for
boot-time page size builds, they are filled in at boot once the page
size is known.

No functional change for compile-time page sizes.

Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
Signed-off-by: Eric Curtin <eric.curtin@docker.com>
(cherry picked from commit 565a75cff5df277dedade0680ed7a3810a4d7d44)
---
 kernel/cgroup/cgroup.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index b3657e72db99..0421e88179b7 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -4495,16 +4495,16 @@ static int cgroup_seqfile_show(struct seq_file *m, void *arg)
 	return 0;
 }
 
-static struct kernfs_ops cgroup_kf_single_ops = {
+static DEFINE_GLOBAL_PAGE_SIZE_VAR(struct kernfs_ops, cgroup_kf_single_ops, {
 	.atomic_write_len	= PAGE_SIZE,
 	.open			= cgroup_file_open,
 	.release		= cgroup_file_release,
 	.write			= cgroup_file_write,
 	.poll			= cgroup_file_poll,
 	.seq_show		= cgroup_seqfile_show,
-};
+});
 
-static struct kernfs_ops cgroup_kf_ops = {
+static DEFINE_GLOBAL_PAGE_SIZE_VAR(struct kernfs_ops, cgroup_kf_ops, {
 	.atomic_write_len	= PAGE_SIZE,
 	.open			= cgroup_file_open,
 	.release		= cgroup_file_release,
@@ -4514,7 +4514,7 @@ static struct kernfs_ops cgroup_kf_ops = {
 	.seq_next		= cgroup_seqfile_next,
 	.seq_stop		= cgroup_seqfile_stop,
 	.seq_show		= cgroup_seqfile_show,
-};
+});
 
 static void cgroup_file_notify_timer(struct timer_list *timer)
 {

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-01  1:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20261201015240.1017259-1-ericcurtin17@gmail.com>
2026-12-01  1:51 ` [RFC PATCH v2 08/43] cgroup: Use DEFINE_GLOBAL_PAGE_SIZE_VAR for the kernfs_ops tables Eric Curtin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox