Skip to content

Commit 0b66781

Browse files
heddchengxm-newton
authored andcommitted
sched/bt: BT schduler cgroup support
Signed-off-by: Xiaoming Gao <[email protected]> Signed-off-by: Hua Liu <[email protected]> Signed-off-by: Xiaogguang Chen <[email protected]> Signed-off-by: Zhiguang Peng <[email protected]> Signed-off-by: Bin Fan <[email protected]> Signed-off-by: He Chen <[email protected]>
1 parent 0dd9de2 commit 0b66781

File tree

16 files changed

+1790
-101
lines changed

16 files changed

+1790
-101
lines changed

include/linux/cgroup-defs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ enum {
9090

9191
CFTYPE_NO_PREFIX = (1 << 3), /* (DON'T USE FOR NEW FILES) no subsys prefix */
9292
CFTYPE_WORLD_WRITABLE = (1 << 4), /* (DON'T USE FOR NEW FILES) S_IWUGO */
93+
#ifdef CONFIG_BT_SCHED
94+
CFTYPE_BT_SHARES = (1 << 5), /* BT-sched shares */
95+
#endif
9396

9497
/* internal flags, do not use outside cgroup core proper */
9598
__CFTYPE_ONLY_ON_DFL = (1 << 16), /* only on default hierarchy */

include/linux/kernel_stat.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ enum cpu_usage_stat {
2929
CPUTIME_GUEST,
3030
CPUTIME_GUEST_NICE,
3131
#ifdef CONFIG_BT_SCHED
32+
CPUTIME_BT_USER,
33+
CPUTIME_BT_NICE,
34+
CPUTIME_BT_SYSTEM,
35+
CPUTIME_BT_SOFTIRQ,
36+
CPUTIME_BT_IRQ,
3237
CPUTIME_BT,
3338
#endif
3439
NR_STATS,

include/linux/sched.h

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,6 @@ struct task_group;
121121

122122
#endif
123123

124-
/*
125-
* Increase resolution of cpu_power calculations
126-
*/
127-
#define SCHED_POWER_SHIFT 10
128-
#define SCHED_POWER_SCALE (1L << SCHED_POWER_SHIFT)
129-
130124
#define SCHED_LOAD_SHIFT 10
131125
#define SCHED_LOAD_SCALE (1L << SCHED_LOAD_SHIFT)
132126

@@ -400,6 +394,15 @@ struct sched_avg {
400394
unsigned long util_avg;
401395
};
402396

397+
struct sched_avg_bt {
398+
u64 last_update_time;
399+
u64 load_sum;
400+
u32 util_sum;
401+
u32 period_contrib;
402+
unsigned long load_avg;
403+
unsigned long util_avg;
404+
};
405+
403406
struct sched_statistics {
404407
#ifdef CONFIG_SCHEDSTATS
405408
u64 wait_start;
@@ -464,6 +467,11 @@ struct sched_entity {
464467
struct cfs_rq *my_q;
465468
#endif
466469

470+
#ifdef CONFIG_BT_GROUP_SCHED
471+
struct bt_rq *bt_rq;
472+
struct bt_rq *bt_my_q;
473+
#endif
474+
467475
#ifdef CONFIG_SMP
468476
/*
469477
* Per entity load average tracking.
@@ -472,6 +480,9 @@ struct sched_entity {
472480
* collide with read-mostly values above.
473481
*/
474482
struct sched_avg avg ____cacheline_aligned_in_smp;
483+
#ifdef CONFIG_BT_SCHED
484+
struct sched_avg_bt bt_avg;
485+
#endif
475486
#endif
476487
};
477488

init/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,11 @@ config FAIR_GROUP_SCHED
730730
depends on CGROUP_SCHED
731731
default CGROUP_SCHED
732732

733+
config BT_GROUP_SCHED
734+
bool "Group scheduling for SCHED_BT"
735+
depends on CGROUP_SCHED
736+
default CGROUP_SCHED
737+
733738
config CFS_BANDWIDTH
734739
bool "CPU bandwidth provisioning for FAIR_GROUP_SCHED"
735740
depends on FAIR_GROUP_SCHED

0 commit comments

Comments
 (0)