Skip to content

Commit

Permalink
serial: Move sysrq members above
Browse files Browse the repository at this point in the history
At the current place members those follow are:
:	upf_t			flags;
:	upstat_t		status;
:	int			hw_stopped;
:	unsigned int		mctrl;
:	unsigned int		timeout;
:	unsigned int		type;
:	const struct uart_ops	*ops;

Together, they give (*ops) 8-byte align on 64-bit platforms.
And `sysrq_ch` introduces 4-byte padding.

On the other side, above:
:	struct device		*dev;
:	unsigned char		hub6;
:	unsigned char		suspended;
:	unsigned char		unused[2];
:	const char		*name;

Adds another 4-byte padding.

Moving sysrq members just before `hub6` allows to save 8 bytes
per-uart_port on 64-bit platforms:
On my gcc, x86_64 sizeof(struct uart_port) goes from 528 to 520.

Signed-off-by: Dmitry Safonov <dima@arista.com>
Link: https://lore.kernel.org/r/20191213000657.931618-3-dima@arista.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Dmitry Safonov authored and Greg Kroah-Hartman committed Dec 17, 2019
1 parent f06327d commit 7e5ed9f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions include/linux/serial_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,6 @@ struct uart_port {
struct uart_icount icount; /* statistics */

struct console *cons; /* struct console, if any */
#if defined(CONFIG_SERIAL_CORE_CONSOLE) || defined(SUPPORT_SYSRQ)
unsigned long sysrq; /* sysrq timeout */
unsigned int sysrq_ch; /* char for sysrq */
#endif

/* flags must be updated while holding port mutex */
upf_t flags;

Expand Down Expand Up @@ -244,6 +239,12 @@ struct uart_port {
resource_size_t mapbase; /* for ioremap */
resource_size_t mapsize;
struct device *dev; /* parent device */

#if defined(CONFIG_SERIAL_CORE_CONSOLE) || defined(SUPPORT_SYSRQ)
unsigned long sysrq; /* sysrq timeout */
unsigned int sysrq_ch; /* char for sysrq */
#endif

unsigned char hub6; /* this should be in the 8250 driver */
unsigned char suspended;
unsigned char unused[2];
Expand Down

0 comments on commit 7e5ed9f

Please sign in to comment.