lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20260115102354.197601-1-zenghongling@kylinos.cn>
Date: Thu, 15 Jan 2026 18:23:54 +0800
From: zenghongling <zenghongling@...inos.cn>
To: mingo@...hat.com,
	juri.lelli@...hat.com,
	dietmar.eggemann@....com,
	rostedt@...dmis.org,
	bsegall@...gle.com,
	mgorman@...e.de,
	vschneid@...hat.com
Cc: linux-kernel@...r.kernel.org,
	zhongling0719@....com,
	zenghongling <zenghongling@...inos.cn>
Subject: [PATCH] sched: Realign struct rt_bandwidth to remove holes and improve access efficiency

Realign struct rt_bandwidth to reduce its size by 8 bytes. Total size
is now 88 bytes and remove holes,rt_runtime_lock and rt_period_activeare
frequently accessed together,Placing them in the same cache line can
improve access efficiency.

pahole output before:

struct rt_bandwidth {
        raw_spinlock_t             rt_runtime_lock;      /*     0     4 */

        /* XXX 4 bytes hole, try to pack */

        ktime_t                    rt_period;            /*     8     8 */
        u64                        rt_runtime;           /*    16     8 */
        struct hrtimer             rt_period_timer;      /*    24    64 */

        /* --- cacheline 1 boundary (64 bytes) was 24 bytes ago --- */
        unsigned int               rt_period_active;     /*    88     4 */

        /* size: 96, cachelines: 2, members: 5 */
        /* sum members: 88, holes: 1, sum holes: 4 */
        /* last cacheline: 32 bytes */
}

after:

struct rt_bandwidth {
        raw_spinlock_t             rt_runtime_lock;      /*     0     4 */
        unsigned int               rt_period_active;     /*     4     4 */
        u64                        rt_runtime;           /*     8     8 */
        ktime_t                    rt_period;            /*    16     8 */
        struct hrtimer             rt_period_timer;      /*    24    64 */

        /* size: 88, cachelines: 2, members: 5 */
        /* last cacheline: 24 bytes */
}

Signed-off-by: zenghongling <zenghongling@...inos.cn>
---
 kernel/sched/sched.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index f2773e91438a..a7c49f54e063 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -313,10 +313,10 @@ struct rt_prio_array {
 struct rt_bandwidth {
 	/* nests inside the rq lock: */
 	raw_spinlock_t		rt_runtime_lock;
+	unsigned int		rt_period_active;
 	ktime_t			rt_period;
 	u64			rt_runtime;
 	struct hrtimer		rt_period_timer;
-	unsigned int		rt_period_active;
 };
 
 static inline int dl_bandwidth_enabled(void)
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ