Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched/fair: Add related data structure for task based throttle

Add related data structures for this new throttle functionality.

Tesed-by: K Prateek Nayak <kprateek.nayak@amd.com>
Signed-off-by: Valentin Schneider <vschneid@redhat.com>
Signed-off-by: Aaron Lu <ziqianlu@bytedance.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Chengming Zhou <chengming.zhou@linux.dev>
Tested-by: Valentin Schneider <vschneid@redhat.com>
Tested-by: Matteo Martelli <matteo.martelli@codethink.co.uk>
Link: https://lore.kernel.org/r/20250829081120.806-2-ziqianlu@bytedance.com

authored by

Valentin Schneider and committed by
Peter Zijlstra
2cd57124 7bd291ab

+24
+5
include/linux/sched.h
··· 883 883 884 884 #ifdef CONFIG_CGROUP_SCHED 885 885 struct task_group *sched_task_group; 886 + #ifdef CONFIG_CFS_BANDWIDTH 887 + struct callback_head sched_throttle_work; 888 + struct list_head throttle_node; 889 + bool throttled; 890 + #endif 886 891 #endif 887 892 888 893
+3
kernel/sched/core.c
··· 4490 4490 4491 4491 #ifdef CONFIG_FAIR_GROUP_SCHED 4492 4492 p->se.cfs_rq = NULL; 4493 + #ifdef CONFIG_CFS_BANDWIDTH 4494 + init_cfs_throttle_work(p); 4495 + #endif 4493 4496 #endif 4494 4497 4495 4498 #ifdef CONFIG_SCHEDSTATS
+13
kernel/sched/fair.c
··· 5748 5748 throttled_hierarchy(dest_cfs_rq); 5749 5749 } 5750 5750 5751 + static void throttle_cfs_rq_work(struct callback_head *work) 5752 + { 5753 + } 5754 + 5755 + void init_cfs_throttle_work(struct task_struct *p) 5756 + { 5757 + init_task_work(&p->sched_throttle_work, throttle_cfs_rq_work); 5758 + /* Protect against double add, see throttle_cfs_rq() and throttle_cfs_rq_work() */ 5759 + p->sched_throttle_work.next = &p->sched_throttle_work; 5760 + INIT_LIST_HEAD(&p->throttle_node); 5761 + } 5762 + 5751 5763 static int tg_unthrottle_up(struct task_group *tg, void *data) 5752 5764 { 5753 5765 struct rq *rq = data; ··· 6484 6472 cfs_rq->runtime_enabled = 0; 6485 6473 INIT_LIST_HEAD(&cfs_rq->throttled_list); 6486 6474 INIT_LIST_HEAD(&cfs_rq->throttled_csd_list); 6475 + INIT_LIST_HEAD(&cfs_rq->throttled_limbo_list); 6487 6476 } 6488 6477 6489 6478 void start_cfs_bandwidth(struct cfs_bandwidth *cfs_b)
+3
kernel/sched/sched.h
··· 739 739 int throttle_count; 740 740 struct list_head throttled_list; 741 741 struct list_head throttled_csd_list; 742 + struct list_head throttled_limbo_list; 742 743 #endif /* CONFIG_CFS_BANDWIDTH */ 743 744 #endif /* CONFIG_FAIR_GROUP_SCHED */ 744 745 }; ··· 2658 2657 extern bool sched_rt_bandwidth_account(struct rt_rq *rt_rq); 2659 2658 2660 2659 extern void init_dl_entity(struct sched_dl_entity *dl_se); 2660 + 2661 + extern void init_cfs_throttle_work(struct task_struct *p); 2661 2662 2662 2663 #define BW_SHIFT 20 2663 2664 #define BW_UNIT (1 << BW_SHIFT)