From 7f1d3c09c9620d6aa5c7c94429e0e2a10a82b6d6 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Tue, 10 Jan 2023 11:30:45 +0100 Subject: [PATCH] QTimerInfo: re-pack the members 0148c6925ec3b6b9a9d2f57ae44fea292a6625e1 added support for qint64 intervals in the abstract dispatcher. Changing the `int` interval to `qint64` causes padding in the QTimerInfo struct. On X86-64: struct TimerInfo { int id; /* 0 4 */ /* XXX 4 bytes hole, try to pack */ qint64 interval; /* 8 8 */ enum TimerType timerType; /* 16 4 */ /* XXX 4 bytes hole, try to pack */ struct timespec timeout; /* 24 16 */ class QObject * obj; /* 40 8 */ class QTimerInfo * * activateRef; /* 48 8 */ /* size: 56, cachelines: 1, members: 6 */ /* sum members: 48, holes: 2, sum holes: 8 */ /* last cacheline: 56 bytes */ }; On ARM32: struct TimerInfo { int id; /* 0 4 */ /* XXX 4 bytes hole, try to pack */ qint64 interval; /* 8 8 */ enum TimerType timerType; /* 16 4 */ struct timespec timeout; /* 20 8 */ class QObject * obj; /* 28 4 */ class QTimerInfo * * activateRef; /* 32 4 */ /* size: 40, cachelines: 1, members: 6 */ /* sum members: 32, holes: 1, sum holes: 4 */ /* padding: 4 */ /* last cacheline: 40 bytes */ }; Change the order of the members, so we remove the padding: struct TimerInfo { int id; /* 0 4 */ enum TimerType timerType; /* 4 4 */ qint64 interval; /* 8 8 */ struct timespec timeout; /* 16 16 */ class QObject * obj; /* 32 8 */ class QTimerInfo * * activateRef; /* 40 8 */ /* size: 48, cachelines: 1, members: 6 */ /* last cacheline: 48 bytes */ }; Pick-to: 6.5 Change-Id: Ia1cc56e497f87611fa411a19361f8ebb13ff1f67 Reviewed-by: Volker Hilsheimer Reviewed-by: Thiago Macieira --- src/corelib/kernel/qtimerinfo_unix_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qtimerinfo_unix_p.h b/src/corelib/kernel/qtimerinfo_unix_p.h index c33bddbd2f..3d80c929e3 100644 --- a/src/corelib/kernel/qtimerinfo_unix_p.h +++ b/src/corelib/kernel/qtimerinfo_unix_p.h @@ -28,8 +28,8 @@ QT_BEGIN_NAMESPACE // internal timer info struct QTimerInfo { int id; // - timer identifier - qint64 interval; // - timer interval in milliseconds Qt::TimerType timerType; // - timer type + qint64 interval; // - timer interval in milliseconds timespec timeout; // - when to actually fire QObject *obj; // - object to receive event QTimerInfo **activateRef; // - ref from activateTimers