From nobody Mon Feb 9 08:28:54 2026 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63CE41F099C; Sat, 10 Jan 2026 04:01:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768017664; cv=none; b=VhurK6BhL9t0rNFHilsi9RkEChIwpGFxgiclpHrxt5l2ZttzpkzelGMX2ftRGfc3xpc3yVCv+fQkg4jg9J7uzltBu5p9ugjwk79+zocu2xDiwiKXDzrYCIoEdRZsZvjn7Q4mOVnnSx5a2G59iq8lVCRzFGl078+fyMGVA6AbZgY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768017664; c=relaxed/simple; bh=5SW9UpEv0nLK1coY4sVVriH3zUD3HiwNzi3GEA3rco4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jZhK0PjvyAubEPwBm2p3A+AAxKriH0OvXWxSsrKZMiHYhclcpv4Lh0tGwKf6bwClYkLekTiN/kixo75YnfwGLqSrQikTKan8lhq1Z/tLmzLVGnX6bczDkNfZrf8K/Op2z/SfYcIEJdZK2BDiSNm6jfspSiI3lSDEb91X6+JA9Z8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=EWcjovho; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="EWcjovho" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=x+neKtrh0OJd7QapgofbeDN3yfzvNs3usU5t8bvxpKQ=; b=EWcjovhosAsZq5017xsM1Oft92 V/GTFzIUMfeDDs7239l/el5uh/Cs+WzxyiLaXiMlERUrz/B80QmG3x/pUh1w9B2ygcQoS0S2z8cdl Ke8FCpzvFyuooLXf7Rnspy1z4Wb7bRF9XKK7a1DZrVKyOy1x44fWvOk+ME3BhrPhfpevGW7svE4PI /M53EWbRUU644eS1Sy7xFkXyIVHeTYjLnYw1TGSGytr3GpgqTqryoQWrTFljJvN16EgDBmQKh6s8M +E4X4cx0Y2kwNCxutzyCvR8U/pFxAJiPsHWuL3hlt9U7UhhO7/Edd/w+6drozjnuw3lTY9J84Jwbp utsmtJyg==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.99 #2 (Red Hat Linux)) id 1veQB9-000000085Zy-1Thv; Sat, 10 Jan 2026 04:02:19 +0000 From: Al Viro To: linux-mm@kvack.org Cc: Vlastimil Babka , Harry Yoo , linux-fsdevel@vger.kernel.org, Linus Torvalds , Christian Brauner , Jan Kara , Mateusz Guzik , linux-kernel@vger.kernel.org Subject: [RFC PATCH 09/15] make filp and bfilp caches static-duration Date: Sat, 10 Jan 2026 04:02:11 +0000 Message-ID: <20260110040217.1927971-10-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260110040217.1927971-1-viro@zeniv.linux.org.uk> References: <20260110040217.1927971-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Al Viro Content-Type: text/plain; charset="utf-8" As much as I hate it, the name "filp" is a part of userland ABI at this point - scripts grepping for it in /proc/slabinfo do exist ;-/ Signed-off-by: Al Viro --- fs/file_table.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/fs/file_table.c b/fs/file_table.c index cd4a3db4659a..18a992b40109 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -27,6 +27,7 @@ #include #include #include +#include =20 #include =20 @@ -38,8 +39,10 @@ static struct files_stat_struct files_stat =3D { }; =20 /* SLAB cache for file structures */ -static struct kmem_cache *filp_cachep __ro_after_init; -static struct kmem_cache *bfilp_cachep __ro_after_init; +static struct kmem_cache_opaque file_cache; +static struct kmem_cache_opaque backing_file_cache; +#define filp_cachep to_kmem_cache(&file_cache) +#define bfilp_cachep to_kmem_cache(&backing_file_cache) =20 static struct percpu_counter nr_files __cacheline_aligned_in_smp; =20 @@ -587,19 +590,20 @@ void fput_close(struct file *file) =20 void __init files_init(void) { - struct kmem_cache_args args =3D { - .use_freeptr_offset =3D true, - .freeptr_offset =3D offsetof(struct file, f_freeptr), - }; - - filp_cachep =3D kmem_cache_create("filp", sizeof(struct file), &args, - SLAB_HWCACHE_ALIGN | SLAB_PANIC | - SLAB_ACCOUNT | SLAB_TYPESAFE_BY_RCU); + __KMEM_CACHE_SETUP(filp_cachep, "filp", sizeof(struct file), + SLAB_HWCACHE_ALIGN | SLAB_PANIC | + SLAB_ACCOUNT | SLAB_TYPESAFE_BY_RCU, + .use_freeptr_offset =3D true, + .freeptr_offset =3D offsetof(struct file, + f_freeptr)); + + __KMEM_CACHE_SETUP(bfilp_cachep, "bfilp", sizeof(struct backing_file), + SLAB_HWCACHE_ALIGN | SLAB_PANIC | + SLAB_ACCOUNT | SLAB_TYPESAFE_BY_RCU, + .use_freeptr_offset =3D true, + .freeptr_offset =3D offsetof(struct backing_file, + bf_freeptr)); =20 - args.freeptr_offset =3D offsetof(struct backing_file, bf_freeptr); - bfilp_cachep =3D kmem_cache_create("bfilp", sizeof(struct backing_file), - &args, SLAB_HWCACHE_ALIGN | SLAB_PANIC | - SLAB_ACCOUNT | SLAB_TYPESAFE_BY_RCU); percpu_counter_init(&nr_files, 0, GFP_KERNEL); } =20 --=20 2.47.3