From patchwork Mon Oct 14 10:58:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13834827 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 35EDED16248 for ; Mon, 14 Oct 2024 11:40:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4UO2yeUO5mzgxVnueQx6h7oEw8kU90IKNX4PaGU1b4Y=; b=zyN+JR/F3HyrCLA/WDeYwkPZ2o rnxbxPvbR248IC7M3juon/Et2oOQopxSzVdqrONCTXSwf79n5WtZNWV3DUHhzcu6pOMEJtLRGhU3g JQB+pIYoxxGrw8zBu74qhNzK+Q1oTBowFd+2A5L9GDBFNJKEgkyoaeg0HriKSt8BYZXPQ1xa2oce6 6UUFkwJpRN20jgbH5obNROfpYopZgBsL00Lpi5P6HzkizJkrsOfLqtVvyvnYnLOhsSsTKM8d/q0E6 sbprmbYeHCy3yis5WdJ6HxoVr7jfSV3MB7BlT0jWnuDMxeQy/b0KWhcW5Y6P0sajjJj8d8AZYUE+g K1VM5Crw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t0JRD-00000004xr0-2LXA; Mon, 14 Oct 2024 11:40:35 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t0Io2-00000004nfK-05Un for linux-arm-kernel@lists.infradead.org; Mon, 14 Oct 2024 11:00:07 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3AD141684; Mon, 14 Oct 2024 04:00:35 -0700 (PDT) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.27]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 94D563F51B; Mon, 14 Oct 2024 04:00:02 -0700 (PDT) From: Ryan Roberts To: =?utf-8?q?Michal_Koutn=C3=BD?= , Andrew Morton , Anshuman Khandual , Ard Biesheuvel , Catalin Marinas , David Hildenbrand , Greg Marsden , Ivan Ivanov , Johannes Weiner , Kalesh Singh , Marc Zyngier , Mark Rutland , Matthias Brugger , Miroslav Benes , Tejun Heo , Will Deacon , Zefan Li Cc: Ryan Roberts , cgroups@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v1 12/57] cgroup: Remove PAGE_SIZE compile-time constant assumption Date: Mon, 14 Oct 2024 11:58:19 +0100 Message-ID: <20241014105912.3207374-12-ryan.roberts@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241014105912.3207374-1-ryan.roberts@arm.com> References: <20241014105514.3206191-1-ryan.roberts@arm.com> <20241014105912.3207374-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241014_040006_131244_C192745A X-CRM114-Status: GOOD ( 10.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org To prepare for supporting boot-time page size selection, refactor code to remove assumptions about PAGE_SIZE being compile-time constant. Code intended to be equivalent when compile-time page size is active. Wrap global variables that are initialized with PAGE_SIZE derived values using DEFINE_GLOBAL_PAGE_SIZE_VAR() so their initialization can be deferred for boot-time page size builds. Signed-off-by: Ryan Roberts --- ***NOTE*** Any confused maintainers may want to read the cover note here for context: https://lore.kernel.org/all/20241014105514.3206191-1-ryan.roberts@arm.com/ 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 c8e4b62b436a4..1e9c96210821d 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -4176,16 +4176,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, @@ -4195,7 +4195,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) {