tty: shrink the size of struct tty_struct by 40 bytes
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Aug 2023 15:28:20 +0000 (17:28 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 27 Aug 2023 09:47:44 +0000 (11:47 +0200)
commitebf05c7dc92c11b0355aaa0e94064beadaa4b05c
tree09e59c0be773a7a452e1c8ccfca62e35b1da5f38
parenta84853c5954fe2c1b97db2f005ae156dc29ae233
tty: shrink the size of struct tty_struct by 40 bytes

It's been a long time since anyone has looked at what struct tty_struct
looks like in memory, turns out there was a ton of holes.

So move things around a bit, change one variable (closing) from being an
int to a bool (it is only being tested for 0/1), and we end up saving 40
bytes per structure overall on x86-64 systems.

Before this patch:
/* size: 696, cachelines: 11, members: 37 */
/* sum members: 665, holes: 8, sum holes: 31 */
/* forced alignments: 2, forced holes: 1, sum forced holes: 4 */
/* last cacheline: 56 bytes */

After this change:
/* size: 656, cachelines: 11, members: 37 */
/* sum members: 654, holes: 1, sum holes: 2 */
/* forced alignments: 2 */
/* last cacheline: 16 bytes */

Cc: Jiri Slaby <jirislaby@kernel.org>
Link: https://lore.kernel.org/r/2023082519-cobbler-unholy-8d1f@gregkh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/tty.h