Whamcloud - gitweb
LU-14520 ldlm: reduce ldlm_lock memory usage 85/56685/4
authorAndreas Dilger <adilger@whamcloud.com>
Mon, 14 Oct 2024 23:23:26 +0000 (17:23 -0600)
committerOleg Drokin <green@whamcloud.com>
Mon, 9 Dec 2024 06:12:58 +0000 (06:12 +0000)
commit029bc1c294c3c78af863ab05524275978f4e1b2d
treea84d8b39194922d20008d1b50afa7bce10341dc7
parentafe24b136a6af60dae25c03c72b207ce672f8f9b
LU-14520 ldlm: reduce ldlm_lock memory usage

Reduce the size of struct ldlm_lock so that it can fit into a 512-byte
slab allocation.  The primary reduction in memory usage is from moving
struct l_ost_lvb into the union for IBITS locks where it is needed,
while it was previously part of the common strucutre.  Add assertions
to verify that the l_ost_lvb field is only used for IBITS lock type.

Additionally, shrink some of the other fields in memory to bitfields
that only use the required bits, and pack them together to save space.
These are read-mostly fields for the lifetime of the lock and give
some space to add fields in the future before hitting 512 bytes again.

  ldlm_lock     BEFORE           PATCHED
      size: 536, members: 36     size: 496, members: 35
      sum used: 536, holes: 0    sum used: 490, holes: 2, sum holes: 6
      bit holes: 0               bit holes: 1, sum bit holes: 10

Also reduce struct ldlm_resource by a few bytes, so that 23 can fit
into a single 4096-byte slab instead of the previous 22 in one slab.

  ldlm_resource BEFORE           PATCHED
      size: 184, members: 14     size: 176, members: 14
      padding: 7, holes: 0       sum used: 171, holes: 1, sum holes: 5
      bit holes: 0               bit holes: 1, sum bit holes: 4

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I7f017a852228f8c9090e890f2766707fdbde2abd
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56685
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lustre_dlm.h
lustre/ldlm/ldlm_lock.c
lustre/ldlm/ldlm_lockd.c
lustre/ldlm/ldlm_request.c
lustre/llite/file.c
lustre/mdc/mdc_dev.c
lustre/mdc/mdc_locks.c
lustre/mdt/mdt_lvb.c
lustre/ofd/ofd_lvb.c