Feature #10050

[PATCH 0/2] reduce rb_io_t to 192 bytes (from 216) on 64-bit

Added by Eric Wong 12 months ago. Updated 12 months ago.

[ruby-core:63781]
Status:Closed
Priority:Normal
Assignee:Eric Wong

Description

This will allow x86-64 machines to only use 3 cache lines instead of 4
(where cache size == 64).

Hopefully there are other 64-bit architectures which benefit, too.

This is also public ABI breakage, so I hope to commit it around when a patch for
Feature #10034 (re_pattern_buffer reduction) gets committed to reduce testers'
need to rebuild C exts.

0001-rb_io_t.p Magnifier (19 Bytes) Eric Wong, 07/17/2014 05:08 AM

0001-rb_io_t.patch Magnifier (1.18 KB) Eric Wong, 07/17/2014 05:11 AM

0002-rb_io_buffer_t.patch Magnifier (966 Bytes) Eric Wong, 07/17/2014 05:13 AM


Related issues

Related to Ruby trunk - Bug #10088: Bus Error on Sparc Solaris since r46884 Closed 07/24/2014

Associated revisions

Revision 46883
Added by normal 12 months ago

rb_io_t: shrink from 216 to 200 bytes on 64-bit

  • include/ruby/io.h (rb_io_t): shrink to 200 bytes from 216 on 64-bit This puts us within 8 bytes of being three cache lines instead of four lines on x86-64. This breaks the ABI. [Feature #10050]

Revision 46883
Added by normal 12 months ago

rb_io_t: shrink from 216 to 200 bytes on 64-bit

  • include/ruby/io.h (rb_io_t): shrink to 200 bytes from 216 on 64-bit This puts us within 8 bytes of being three cache lines instead of four lines on x86-64. This breaks the ABI. [Feature #10050]

Revision 46884
Added by normal 12 months ago

rb_io_buffer_t: pack structure

  • include/ruby/io.h (rb_io_buffer_t): pack structure Reduces rb_io_t from 200 to 192 bytes, allowing rb_io_t to occupy one less cache line. [Feature #10050]

n.b. this leaves a 4-byte hole after the `cbuf' field which may
be used for future expansion.

Revision 46884
Added by normal 12 months ago

rb_io_buffer_t: pack structure

  • include/ruby/io.h (rb_io_buffer_t): pack structure Reduces rb_io_t from 200 to 192 bytes, allowing rb_io_t to occupy one less cache line. [Feature #10050]

n.b. this leaves a 4-byte hole after the `cbuf' field which may
be used for future expansion.

History

#1 Updated by Eric Wong 12 months ago

#2 Updated by Eric Wong 12 months ago

#3 Updated by Eric Wong 12 months ago

I forgot to note this the last publically-visible struct which may be
packed. Internals for the others are defined privately:

$ pahole -P ruby
rb_thread_struct    1016    1000    16
rb_execarg  160 152 8
io_internal_writev_struct   24  16  8
io_advise_struct    32  24  8
waitpid_arg 24  16  8
load_file_arg   48  40  8
rb_econv_t  200 184 16
rb_transcoder   160 152 8
rb_context_struct   1312    1304    8
rb_fiber_struct 2304    2296    8
parser_params   320 304 16

#4 Updated by Anonymous 12 months ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Applied in changeset r46883.


rb_io_t: shrink from 216 to 200 bytes on 64-bit

  • include/ruby/io.h (rb_io_t): shrink to 200 bytes from 216 on 64-bit This puts us within 8 bytes of being three cache lines instead of four lines on x86-64. This breaks the ABI. [Feature #10050]

#5 Updated by Naohisa Goto 12 months ago

  • Related to Bug #10088: Bus Error on Sparc Solaris since r46884 added

Also available in: Atom PDF