[RFC PATCH 02/22] sched/fair: Convert "se->runnable_weight" to unsigned int and pack the struct

From: K Prateek Nayak
Date: Thu Feb 20 2025 - 04:34:54 EST


se->runnable_weight tracks group_cfs_rq(se)->h_nr_running which is an
unsigned int. Convert runnable_weight to an unsigned int to match the
types.

pahole notes that there is a 4 byte hole after se's "depth" member
since depth is an integer. Move depth below runnable_weight to prevent
the 4 byte hole and reclaim 8 bytes of space in total.

Signed-off-by: K Prateek Nayak <kprateek.nayak@xxxxxxx>
---
include/linux/sched.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 9632e3318e0d..34862d904ea3 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -569,14 +569,14 @@ struct sched_entity {
u64 nr_migrations;

#ifdef CONFIG_FAIR_GROUP_SCHED
- int depth;
struct sched_entity *parent;
/* rq on which this entity is (to be) queued: */
struct cfs_rq *cfs_rq;
/* rq "owned" by this entity/group: */
struct cfs_rq *my_q;
/* cached value of my_q->h_nr_running */
- unsigned long runnable_weight;
+ unsigned int runnable_weight;
+ int depth;
#endif

#ifdef CONFIG_SMP
--
2.43.0