Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
11.8, 12.3
-
None
-
Related to performance
Description
Following MDEV-33966's PR #5763, a size reduction of buf_block_t to 0x80 (128) bytes may be possible, on 64-bit targets without SUX_LOCK_GENERIC, with BTR_CUR_HASH_ADAPT defined.
The struct size (under the same conditions) before the PR is 152 bytes.
The PR reduces it to 144 bytes.
Therefore, 16 more bytes shall be shaved off the struct to reach the goal, which will improve cache-friendliness.
I will cite here two suggestions from marko on how to proceed (from a comment in the aforementioned PR):
We could perhaps shave off 8 bytes (one pointer) by making the patented buf_pool.unzip_LRU singly linked. Or add one level of pointer introduction and make b.zip.data point to an indirection node (two unzip_LRU pointers and the compressed data) when b.belongs_to_unzip_LRU() holds?
For reference, the pre-MDEV-33966 and post-MDEV-33966 layout of the buf_block_t struct (considering a 64-byte cache line size, for a struct that starts on a cache-line boundary):
| Offset | Line | pre- |
Size | post- |
Size |
|---|---|---|---|---|---|
| 0x00 | 0 | page.id_ | 8 | page.id_ | 8 |
| 0x08 | 0 | page.hash (union: used_records, free_offset) | 8 | page.hash (union: used_records, free_offset) | 8 |
| 0x10 | 0 | page.oldest_modification_ | 8 | page.oldest_modification_ | 8 |
| 0x18 | 0 | page.lock | 24 | page.modify_clock_low | 4 |
| 0x1C | 0 | (cont. page.lock) | page.modify_clock_high | 2 | |
| 0x1E | 0 | (cont. page.lock) | page.access_time (Atomic_relaxed<uint16_t>) | 2 | |
| 0x20 | 0 | (cont. page.lock) | page.lock | 24 | |
| 0x30 | 0 | page.frame | 8 | (cont. page.lock) | |
| 0x38 | 0 | page.zip.data | 8 | page.frame | 8 |
| 0x40 | 1 | page.zip bit-fields (m_end:16, m_nonempty:1, n_blobs:12, ssize:3) | 4 | page.zip.data | 8 |
| 0x44 | 1 | page.zip.fix | 4 | (cont. page.zip.data) | |
| 0x48 | 1 | page.list | 16 | page.zip.m_end | 2 |
| 0x4A | 1 | (cont. page.list) | page.zip.state | 2 | |
| 0x4C | 1 | (cont. page.list) | page.zip.fix | 4 | |
| 0x50 | 1 | (cont. page.list) | page.list | 16 | |
| 0x58 | 1 | page.LRU | 16 | (cont. page.list) | |
| 0x60 | 1 | (cont. page.LRU) | page.LRU | 16 | |
| 0x68 | 1 | page.old:1, page.freed_page_clock:31 | 4 | (cont. page.LRU) | |
| 0x6C | 1 | page.access_time (Atomic_counter<unsigned>) | 4 | (cont. page.LRU) | |
| 0x70 | 1 | end of buf_page_t (112); unzip_LRU | 16 | end of buf_page_t (112); unzip_LRU | 16 |
| 0x80 | 2 | modify_clock (ib_uint64_t) | 8 | ahi_left_bytes_fields | 4 |
| 0x84 | 2 | (cont. modify_clock) | n_hash_helps | 2 | |
| 0x86 | 2 | (cont. modify_clock) | (hole) | 2 | |
| 0x88 | 2 | ahi_left_bytes_fields | 4 | index | 8 |
| 0x8C | 2 | n_hash_helps | 2 | (cont. index) | |
| 0x8E | 2 | (hole) | 2 | (cont. index) | |
| 0x90 | 2 | index | 8 | end of buf_block_t (144) | |
| 0x98 | 2 | end of buf_block_t (152) |
Layouts have been checked with pahole in RelWithDebInfo builds.
Attachments
Issue Links
- is blocked by
-
MDEV-33966 sysbench performance regression with concurrent workloads
-
- Closed
-
- relates to
-
MDEV-39452 22% reduction of sizeof(dict_index_t) is easily possible
-
- Open
-