Bug #57707 InnoDB buf_page_t size has doubled on 32-bit systems
Submitted: 25 Oct 2010 8:30 Modified: 9 Dec 2010 22:40
Reporter: Marko Mäkelä Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.5+ OS:Any
Assigned to: Marko Mäkelä
Tags: buf_page_t, compression, innodb_buffer_pool_instances
Triage: Needs Triage: D3 (Medium) / R1 (None/Negligible) / E1 (None/Negligible)

[25 Oct 2010 8:30] Marko Mäkelä
Description:
When multiple buffer pools (innodb_buffer_pool_instances) were implemented in InnoDB, a buf_pool pointer was added to buf_page_t. Before this change, the storage size of buf_page_t was exactly 64 bytes on 32-bit systems, which avoided any memory fragmentation in buf0buddy.c. After this change, the memory use of small-page-size compressed tables increased significantly.

I noticed this, because code built with UNIV_DEBUG_VALGRIND complained about uninitialized bytes in buf_page_t. These checks are only enabled on 32-bit systems, because on 64-bit systems the pointers in buf_page_t would make the structure larger, containing some uninitialized pad bytes.

How to repeat:
Build 32-bit binaries of MySQL 5.5 or later. Note that sizeof(buf_page_t) is more than 64 bytes. Alternatively, build it with Valgrind support enabled, and observe the warnings about uninitialized bytes during custom check requests.

Suggested fix:
Remove the buf_pool pointer from buf_page_t. Use a 6-bit index instead (enough for the current maximum of 64 buffer pools). Allocate the 6 bits by reducing the size of buf_fix_count from 25 to 19 bits (524,288 concurrent transactions should still be more than enough).
[27 Oct 2010 6:57] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/122020
[27 Oct 2010 6:57] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/122021
[27 Oct 2010 18:51] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/122138
[27 Oct 2010 18:51] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/122139
[13 Nov 2010 16:15] Bugs System
Pushed into mysql-trunk 5.6.99-m5 (revid:alexander.nozdrin@oracle.com-20101113155825-czmva9kg4n31anmu) (version source revid:alexander.nozdrin@oracle.com-20101113152450-2zzcm50e7i4j35v7) (merge vers: 5.6.1-m4) (pib:21)
[13 Nov 2010 16:41] Bugs System
Pushed into mysql-next-mr (revid:alexander.nozdrin@oracle.com-20101113160336-atmtmfb3mzm4pz4i) (version source revid:alexander.nozdrin@oracle.com-20101113152540-gxro4g0v29l27f5x) (pib:21)
[16 Dec 2010 22:34] Bugs System
Pushed into mysql-5.5 5.5.9 (revid:jonathan.perkin@oracle.com-20101216101358-fyzr1epq95a3yett) (version source revid:jonathan.perkin@oracle.com-20101216101358-fyzr1epq95a3yett) (merge vers: 5.5.9) (pib:24)