Details
-
Improvement
-
Resolution: Won't Fix
-
Major
-
None
-
Lustre 2.4.0
-
6841
Description
Looking at struct cl_page there seems to be a lot of wasted memory, and since there may be millions of these structures in memory for every client, this wasted space can be considerable.
- 32-bit cp_ref is followed by 64-bit cp_obj, wastes 4 bytes
- 32-bit cp_state is followed by 64-bit cp_batch, wastes 4 bytes
- cp_state only has 5 states, could fit into a 3-bit field
- cp_type only has 1 bit, could fit into a 1-bit field, and is immutable after creation so no worries about racy updates/locking
- 32-bit cp_flags is followed by 64-bit cp_sync_io, wastes 4 bytes
- cp_flags only has 1 bit, could fit into a 1-bit field (not totally sure about locking)
- 64-bit cp_task is only set in 2 places, and never used
- 64-bit cp_queue_ref and cp_obj_ref are only used under USE_LU_REF and can also be made conditional
The structure cl_req has similar space wastage, though it isn't used as often as cl_page:
- 32-bit crq_type is followed by 64-bit crq_pages, wastes 4 bytes
- crq_type only uses two flags, could be a bitfield
- 32-bit crq_npages is followed by 64-bi crq_o, wastes 4 bytes
- 32-bit crq_nrobjs is followed by 64-bit crq_layers, wastes 4 bytes
Using the "pahole" program (part of the "dwarves" package) can report on binary structures for space wastage and alignment problems.