From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F2E248034C for ; Tue, 18 Aug 2026 18:11:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787076712; cv=none; b=jbnmTN313S45g8HGNZt+mV74UC2kO59JpOgY2M96h9Uxn2Rbiftcfj1NeOqVQH+lDR5XqOEBEVslDWFrz8+DOR3k23pidwmeYeT9v2w46HEr4afK+6lb121MVLsW895fBVTIJg+OhPAPdCG+GRrRzERlsp1dB41WLNnPJ3qbCic= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787076712; c=relaxed/simple; bh=fioPhgmHciMoE7UuKEunmKhTSqD6P38N0y1XF4t3Zzs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=iSj9ycNtLPJaWRnrLxkiMnSWjesy20wKTbhqSoa5D5RJHJxX8EQD758tZqUfWR4VkuYuYmSO1gE0+nFgZbhQzBJxBivPfDfPuEX9+mfNA5zIWdie4locXmuUVY3V+1zCpdfHa1ceij6nc0IDwLUYr2WmtSbTmL0QzBAYCYe3H0w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ionos.com; spf=pass smtp.mailfrom=ionos.com; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b=XPVxrZyG; arc=none smtp.client-ip=209.85.221.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=ionos.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ionos.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ionos.com header.i=@ionos.com header.b="XPVxrZyG" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-47f6609c657so38985f8f.2 for ; Tue, 18 Aug 2026 11:11:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1787076708; x=1787681508; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=VFGA6zfBRvuka79KLiQKGKF/hjDIO9g5AnMpvdvhUHs=; b=XPVxrZyGqGT5e5DaPInYW/xJq942zPeXJSABEtatoWJg832AXkBvmngXKWdiJ837vs elOaOB5qnXfY56MhhjD/gBTyDf8vVoyLfDWkp07iuXLSZVGmu3klZ/Diu9G/Wa/mQTZU nI+RtHJVhXHFIpteW4f7ci3isDaTLD9jZWYWDjjI+8LjKR/trOcI+5Dci+fvtM616B6o b9t1PpQDc8N7JrJH/Yw7bD4UO6PlvDkJsCTb0L2ZfD3H5PgQf4VNYnCUQgL5WjnWnNeN CawGnXChPdLX+bSozC58DDby/8+avT5CKUnd/K6DBx8PFXeW2StdC15fL3Fb9cJUDTFr oOJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787076708; x=1787681508; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=VFGA6zfBRvuka79KLiQKGKF/hjDIO9g5AnMpvdvhUHs=; b=ZDQf5MO8/NrP1TiNSzxg+cHP1fN84lwdxi9Hfc8Z+94FMk8HJ9e3RdCwa8+cU/rsWj YUdZ7nL0dkVq6GfXmL2WzrwIcBU+MteQdbqr3KkpKXGGCLYFuJfxlL9ikwSKLfTlEzHm 0gwtVsSfqJfBHB+8/6Jon1XgapsYEZPGtvfWnXQBp89zdIClJPLubnX8lkvdv/1+vLZR 3bugU0uioeHTYyOv3RnndkobGG3oJK5xEj4h+aO/6xG3NmJibQrxmsxUwaqsDt8J1UZm 2Os7N6go23UX57m7r5Z7lFewKIXaPBE2mfstuuF6N4C6Wert3E1+NnNuRkdbOU6yDNiq 2QzA== X-Forwarded-Encrypted: i=1; AHgh+Rp7LceJXxODadTY6O3qizr1mtghBOTWv+C8frwzPjczMZsHSo23Vw57wHliEFeO2KJMtqi4uYM30zUN150=@vger.kernel.org X-Gm-Message-State: AOJu0Yz6/mapkEGr7wrI7zEZYqOjlHYF0JxBoZ1BarpCm4YeyHx/151V HXiNPm1KNTQdup5Fc5nL8yEZWZ6A1efT0JWk2d1otbmo+Nirj6wm/WCRTYKP+AK1KsDWWY98Umh H77ztmZI= X-Gm-Gg: AR+sD10Z2YEr0LIkcRIWMu0OMLjFK+9t7R9ZRNRCERHF+t26cisfZtnFgtLUPk3XmdL cx+9D9iUhw9TIiuyBaWdUmy8Z2WvUTPUJc+Gz6quqJpYCxYyAsN3Pfh4mOSrZuti2Xi6nrVMe9C vS2MbCLvya/Hz+ZpJBKodp4vYp7c0kEDcKyTnvEQcrl/3zsPpx8L7aOzX5Ekt4qn/lOE8e7XDy+ M2QZFTH8qsQjK4n2KkZ+RuE28DZHY+o0feE8OLuPItpM0aT0ggbMWzaiU2P02X4t1FWomvy0MmB Sd2B/b6Go4O9CfHMbXDCJQUm7V4cq8n02lnxeL7Hn+/oc2tp9vBozbDo6GAHd/Cycna/gHG6ASo wGtcfmRnySVLCyp1UhkzxNYNqRRdtFYmFDQRdqURbXk/LUM6BIrMBrhO0vtBsE/dPZCoygJl4AP 8xSSxaBMRGCoyfv/iY1KqqyJtoBN8BJc1anfEbQS6pWpIGkruEanwQM+rkcro8zmNoTJjHkNd6n TGGKEaKUjWWebGR4fYGhFDjIig/bvmsN/0LZ3DX2y6HuaTNUfZlGiZGFQad0T7u X-Received: by 2002:a5d:480a:0:b0:481:4697:8808 with SMTP id ffacd0b85a97d-48160798dcbmr48554864f8f.22.1787076707911; Tue, 18 Aug 2026 11:11:47 -0700 (PDT) Received: from raven.intern.cm-ag (p200300dc6f02b200023064fffe740809.dip0.t-ipconnect.de. [2003:dc:6f02:b200:230:64ff:fe74:809]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-482a5a3b896sm14302641f8f.16.2026.08.18.11.11.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Aug 2026 11:11:47 -0700 (PDT) From: Max Kellermann To: idryomov@gmail.com, amarkuze@redhat.com, xiubo.li@clyso.com, ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Max Kellermann Subject: [PATCH v4 00/12] fs/ceph: optimize struct layouts Date: Tue, 18 Aug 2026 20:11:32 +0200 Message-ID: <20260818181144.3541770-1-max.kellermann@ionos.com> X-Mailer: git-send-email 2.47.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This patch set aims to reduce the memory usage of the Ceph filesystems by optimizing the layout of structs, most importantly struct ceph_inode_info: - use `bool` instead of `int` for booelans - use `u32` instead of `u64` where possible - reorder fields to eliminate padding holes - eliminate redundant fields Without this patch set, ceph_inode_info looks like this with pahole: /* size: 1456, cachelines: 23, members: 79 */ /* sum members: 1424, holes: 8, sum holes: 32 */ /* member types with holes: 3, total: 3 */ With this patch set, struct ceph_inode_info got smaller by 96 bytes: /* size: 1360, cachelines: 22, members: 76 */ /* member types with holes: 1, total: 1 */ struct ceph_cap shrinks by 24 bytes: /* size: 120, cachelines: 2, members: 12 */ /* size: 96, cachelines: 2, members: 10 */ struct ceph_snap_realm shrinks by 24 bytes, too: /* size: 232, cachelines: 4, members: 21 */ /* sum members: 216, holes: 3, sum holes: 12 */ /* size: 208, cachelines: 4, members: 20 */ --- v1->v2: - fix CONFIG_FS_ENCRYPTION check in "i_truncate_pagecache_size" patch - add patches to shrink ceph_cap and ceph_snap_realm v2->v3: - rebase on latest master v3->v4: - drop the buggy ceph_in_snap() change from ceph_d_prune() - fix -Wunused-variable on BITS_PER_LONG<64 Max Kellermann (12): fs/ceph/super: remove unused field `i_cap_migration_resv` fs/ceph/super: make field `i_truncate_pagecache_size` optional include/ceph/ceph_fs.h: convert `pool_id` to u32 fs/ceph/super.h: convert ceph_inode_xattr fields to `bool` fs/ceph/super.h: convert ceph_cap_snap.writing fields to `bool` fs/ceph: consistently use `u32` for `time_warp_seq` fs/ceph/super: reorder fields to eliminate padding holes fs/ceph: remove i_truncate_mutex, use i_fragtree_mutex for both fs/ceph/super.h: add `const` to helpers fs/ceph/super.h: add helper ceph_in_snap() fs/ceph: use ceph_vino() etc. instead of accessing i_vino directly fs/ceph: remove redundant inode number from ceph_inode_info fs/ceph/acl.c | 2 +- fs/ceph/addr.c | 23 ++++---- fs/ceph/cache.c | 4 +- fs/ceph/caps.c | 8 +-- fs/ceph/dir.c | 20 +++---- fs/ceph/export.c | 8 +-- fs/ceph/file.c | 28 +++++----- fs/ceph/inode.c | 40 +++++++++----- fs/ceph/mds_client.c | 12 ++--- fs/ceph/mds_client.h | 2 +- fs/ceph/quota.c | 6 +-- fs/ceph/snap.c | 8 +-- fs/ceph/super.h | 102 +++++++++++++++++++++++++---------- fs/ceph/util.c | 8 +-- fs/ceph/xattr.c | 18 +++---- include/linux/ceph/ceph_fs.h | 2 +- 16 files changed, 173 insertions(+), 118 deletions(-) -- 2.47.3