EcryptFS development
 help / color / mirror / Atom feed
From: Eric Curtin <ericcurtin17@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Eric Curtin <eric.curtin@docker.com>,
	Tyler Hicks <code@tyhicks.com>,
	ecryptfs@vger.kernel.org
Subject: [RFC PATCH v2 12/22] ecryptfs: Resolve the PAGE_SIZE cache sizes at cache creation time
Date: Wed,  2 Dec 2026 03:15:15 +0000	[thread overview]
Message-ID: <20261202031533.1665444-13-ericcurtin17@gmail.com> (raw)
In-Reply-To: <20261202031533.1665444-1-ericcurtin17@gmail.com>

From: Eric Curtin <eric.curtin@docker.com>

With arm64 boot-time page size selection PAGE_SIZE is not a compile-time
constant, so it cannot initialise the static ecryptfs_cache_infos[]
table.

Drop the PAGE_SIZE sizes of the ecryptfs_headers and
ecryptfs_xattr_cache entries, and treat a size of 0 as PAGE_SIZE in
ecryptfs_init_kmem_caches(), where the value is known at run time.

No functional change for compile-time page sizes.

Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
 fs/ecryptfs/main.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index 5f37cddb956f..bce3250047e3 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -655,7 +655,7 @@ inode_info_init_once(void *vptr)
 static struct ecryptfs_cache_info {
 	struct kmem_cache **cache;
 	const char *name;
-	size_t size;
+	size_t size;	/* 0 means PAGE_SIZE */
 	slab_flags_t flags;
 	void (*ctor)(void *obj);
 } ecryptfs_cache_infos[] = {
@@ -684,12 +684,10 @@ static struct ecryptfs_cache_info {
 	{
 		.cache = &ecryptfs_header_cache,
 		.name = "ecryptfs_headers",
-		.size = PAGE_SIZE,
 	},
 	{
 		.cache = &ecryptfs_xattr_cache,
 		.name = "ecryptfs_xattr_cache",
-		.size = PAGE_SIZE,
 	},
 	{
 		.cache = &ecryptfs_key_record_cache,
@@ -744,7 +742,7 @@ static int ecryptfs_init_kmem_caches(void)
 		struct ecryptfs_cache_info *info;
 
 		info = &ecryptfs_cache_infos[i];
-		*(info->cache) = kmem_cache_create(info->name, info->size, 0,
+		*(info->cache) = kmem_cache_create(info->name, info->size ?: PAGE_SIZE, 0,
 				SLAB_HWCACHE_ALIGN | info->flags, info->ctor);
 		if (!*(info->cache)) {
 			ecryptfs_free_kmem_caches();

      reply	other threads:[~2026-12-02  3:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  3:15 [RFC PATCH v2 00/22] fs: Prepare for boot-time page size selection on arm64 Eric Curtin
2026-12-02  3:15 ` Eric Curtin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261202031533.1665444-13-ericcurtin17@gmail.com \
    --to=ericcurtin17@gmail.com \
    --cc=code@tyhicks.com \
    --cc=ecryptfs@vger.kernel.org \
    --cc=eric.curtin@docker.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox