Whamcloud - gitweb
LU-15619 osc: pack osc_async_page better
The oap_cmd field was used to store a number of other flags, but
those were redundant with oap_brw_page.flag, and never used.
That allows shrinking oap_cmd down to 2 bits.
Modern GCC allows specifying a bitfield for an enum, so the size
can be explicitly set.
The oap_page_off always holds < PAGE_SIZE, so it can safely fit
into PAGE_SHIFT bits, similar to ops_from. However, since this
field is used in math operations and we don't need the space,
always allocate it as an aligned 16-bit field.
This allows packing oap_async_flags, oap_cmd, and oap_page_off
into a 32-bit space. This avoids having holes in the struct. The
explicit oap_padding fields are needed so that "packed" does not
cause the fields to be misaligned, but still allows packing with
the following 4-byte field in osc_page.
Also move oap_brw_page to the end of the struct, since the
bp_padding field therein is useless and can be removed. This
allows better packing with the bitfields in struct osc_page.
brw_page old size: 32, holes: 0, padding: 4
brw_page new size: 28, holes: 0, padding: 0
osc_async_page old size: 104, holes: 8, padding: 4
osc_async_page new size: 92, holes: 0, bit holes: 10
osc_page old size: 144, holes: 8, bit holes: 4
osc_page new size: 128, holes: 0, bit holes: 4
Together this saves 16 bytes *per page* in cache,
and fits osc_page into a noce-sized allocation.
That is 512MiB on a system with 128GiB of cache.
Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: Ief6aa7664d7299dba02332bc9029e4e9219d0876
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/46721
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>