Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function: TT-sched #6

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 2 additions & 15 deletions arch/x86/configs/hwe_desktop_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,22 @@ CONFIG_IKHEADERS=m
CONFIG_LOG_BUF_SHIFT=18
CONFIG_UCLAMP_TASK=y
CONFIG_NUMA_BALANCING=y
CONFIG_CGROUPS=y
CONFIG_MEMCG=y
CONFIG_BLK_CGROUP=y
CONFIG_CFS_BANDWIDTH=y
CONFIG_UCLAMP_TASK_GROUP=y
CONFIG_CGROUP_PIDS=y
CONFIG_CGROUP_RDMA=y
CONFIG_CGROUP_FREEZER=y
CONFIG_CGROUP_HUGETLB=y
CONFIG_CPUSETS=y
# CONFIG_PROC_PID_CPUSET is not set
CONFIG_CGROUP_DEVICE=y
CONFIG_CGROUP_CPUACCT=y
CONFIG_CGROUP_PERF=y
CONFIG_CGROUP_BPF=y
CONFIG_CGROUP_MISC=y
CONFIG_NAMESPACES=y
CONFIG_USER_NS=y
CONFIG_CHECKPOINT_RESTORE=y
CONFIG_SCHED_AUTOGROUP=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_EXPERT=y
CONFIG_KALLSYMS_ALL=y
Expand Down Expand Up @@ -149,11 +147,7 @@ CONFIG_MODVERSIONS=y
CONFIG_MODULE_SRCVERSION_ALL=y
CONFIG_MODULE_SIG_SHA512=y
CONFIG_BLK_DEV_ZONED=y
CONFIG_BLK_DEV_THROTTLING=y
CONFIG_BLK_WBT=y
CONFIG_BLK_CGROUP_IOLATENCY=y
CONFIG_BLK_CGROUP_IOCOST=y
CONFIG_BLK_CGROUP_IOPRIO=y
CONFIG_BLK_SED_OPAL=y
CONFIG_PARTITION_ADVANCED=y
CONFIG_AIX_PARTITION=y
Expand All @@ -174,7 +168,6 @@ CONFIG_SYSV68_PARTITION=y
CONFIG_CMDLINE_PARTITION=y
CONFIG_MQ_IOSCHED_KYBER=m
CONFIG_IOSCHED_BFQ=m
CONFIG_BFQ_GROUP_IOSCHED=y
CONFIG_BINFMT_MISC=m
CONFIG_MEMORY_HOTPLUG=y
CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE=y
Expand Down Expand Up @@ -348,7 +341,6 @@ CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m
CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m
CONFIG_NETFILTER_XT_MATCH_BPF=m
CONFIG_NETFILTER_XT_MATCH_CGROUP=m
CONFIG_NETFILTER_XT_MATCH_CLUSTER=m
CONFIG_NETFILTER_XT_MATCH_COMMENT=m
CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
Expand Down Expand Up @@ -584,7 +576,6 @@ CONFIG_CLS_U32_MARK=y
CONFIG_NET_CLS_RSVP=m
CONFIG_NET_CLS_RSVP6=m
CONFIG_NET_CLS_FLOW=m
CONFIG_NET_CLS_CGROUP=m
CONFIG_NET_CLS_BPF=m
CONFIG_NET_CLS_FLOWER=m
CONFIG_NET_CLS_MATCHALL=m
Expand Down Expand Up @@ -637,8 +628,6 @@ CONFIG_QRTR_SMD=m
CONFIG_QRTR_TUN=m
CONFIG_NET_NCSI=y
CONFIG_NCSI_OEM_CMD_GET_MAC=y
CONFIG_CGROUP_NET_PRIO=y
CONFIG_BPF_STREAM_PARSER=y
CONFIG_NET_PKTGEN=m
CONFIG_NET_DROP_MONITOR=y
CONFIG_HAMRADIO=y
Expand Down Expand Up @@ -2114,8 +2103,6 @@ CONFIG_TCG_TIS_ST33ZP24_SPI=m
CONFIG_TELCLOCK=m
CONFIG_XILLYBUS=m
CONFIG_XILLYBUS_PCIE=m
CONFIG_RANDOM_TRUST_CPU=y
CONFIG_RANDOM_TRUST_BOOTLOADER=y
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_MUX_GPIO=m
CONFIG_I2C_MUX_LTC4306=m
Expand Down
24 changes: 23 additions & 1 deletion include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,23 @@ struct sched_statistics {
#endif /* CONFIG_SCHEDSTATS */
} ____cacheline_aligned;

#ifdef CONFIG_TT_SCHED
struct tt_node {
struct tt_node* next;
struct tt_node* prev;
unsigned int task_type;
u64 vruntime;
u64 start_time;

u64 prev_wait_time;
u64 wait_time;
u64 prev_burst;
u64 curr_burst;
u64 burst;
unsigned int rt_sticky;
};
#endif

struct sched_entity {
/* For load-balancing: */
struct load_weight load;
Expand All @@ -544,9 +561,14 @@ struct sched_entity {

u64 exec_start;
u64 sum_exec_runtime;
u64 vruntime;
u64 prev_sum_exec_runtime;

#ifdef CONFIG_TT_SCHED
struct tt_node tt_node;
#endif

u64 vruntime;

u64 nr_migrations;

#ifdef CONFIG_FAIR_GROUP_SCHED
Expand Down
7 changes: 7 additions & 0 deletions include/linux/sched/sysctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ enum { sysctl_hung_task_timeout_secs = 0 };

extern unsigned int sysctl_sched_child_runs_first;

#ifdef CONFIG_TT_SCHED
extern unsigned int tt_balancer_opt;
extern unsigned int tt_grq_balance_ms;
extern unsigned int tt_max_lifetime;
extern int tt_rt_prio;
#endif

enum sched_tunable_scaling {
SCHED_TUNABLESCALING_NONE,
SCHED_TUNABLESCALING_LOG,
Expand Down
18 changes: 17 additions & 1 deletion init/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,19 @@ config THREAD_INFO_IN_TASK
One subtle change that will be needed is to use try_get_task_stack()
and put_task_stack() in save_thread_stack_tsk() and get_wchan().

config TT_SCHED
bool "TT Scheduler"
default y

config TT_ACCOUNTING_STATS
bool "TT include all accounting and statistics"
depends on TT_SCHED
default y
help
This will include all CFS tasks' load accounting and statistics.
If you are using 'performance' governor and do not depend/care
about tasks statistics, then choose N. Otherwise say Y.

menu "General setup"

config BROKEN
Expand Down Expand Up @@ -825,7 +838,7 @@ menu "Scheduler features"

config UCLAMP_TASK
bool "Enable utilization clamping for RT/FAIR tasks"
depends on CPU_FREQ_GOV_SCHEDUTIL
depends on CPU_FREQ_GOV_SCHEDUTIL && TT_ACCOUNTING_STATS
help
This feature enables the scheduler to track the clamped utilization
of each CPU based on RUNNABLE tasks scheduled on that CPU.
Expand Down Expand Up @@ -1005,6 +1018,7 @@ config CGROUP_WRITEBACK

menuconfig CGROUP_SCHED
bool "CPU controller"
depends on !TT_SCHED
default n
help
This feature lets CPU scheduler recognize task groups and control CPU
Expand Down Expand Up @@ -1282,6 +1296,8 @@ config CHECKPOINT_RESTORE

config SCHED_AUTOGROUP
bool "Automatic process group scheduling"
default n
depends on !TT_SCHED
select CGROUPS
select CGROUP_SCHED
select FAIR_GROUP_SCHED
Expand Down
1 change: 1 addition & 0 deletions kernel/Kconfig.preempt
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ config PREEMPT_DYNAMIC
config SCHED_CORE
bool "Core Scheduling for SMT"
depends on SCHED_SMT
depends on !TT_SCHED
help
This option permits Core Scheduling, a means of coordinated task
selection across SMT siblings. When enabled -- see
Expand Down
4 changes: 4 additions & 0 deletions kernel/sched/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ endif
# build parallelizes well and finishes roughly at once:
#
obj-y += core.o
ifeq ($(CONFIG_TT_SCHED),y)
obj-y += bs.o
else
obj-y += fair.o
endif
obj-y += build_policy.o
obj-y += build_utility.o
Loading