From 7093d7568eb0dd30073f1aa698434a43bb1ff50f Mon Sep 17 00:00:00 2001 From: Cruz Zhao Date: Sat, 2 Apr 2022 11:45:29 +0800 Subject: [PATCH] anolis: sched: Credit clarification for BVT and its related work ANBZ: #781 Group Identity is a totally different feature from BVT, and the defination and logic of bvt_warp_ns has been totally reformed. While 10 lines of code are related to BVT paper and it's code (Jacob Leverich), this patch gives credit to BVT and its related work. Signed-off-by: Cruz Zhao Signed-off-by: Michael Wang Signed-off-by: Shanpei Chen Acked-by: Michael Wang --- kernel/sched/core.c | 25 ++++++++++++++++++++++++- kernel/sched/fair.c | 8 ++++++++ kernel/sysctl.c | 5 +++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index fd81dd3a182551..07702a7af5d919 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -7087,7 +7087,30 @@ static struct cftype cpu_legacy_files[] = { }, #endif #ifdef CONFIG_GROUP_IDENTITY - /* legacy bvt interface */ + /* legacy bvt interface + * + * BVT(Borrowed Virtual Time) is derived from paper: + * "Borrowed-virtual-time (BVT) scheduling: supporting + * latency-sensitive threads in a general-purpose scheduler" + * Link: https://dl.acm.org/doi/abs/10.1145/319344.319169 + * + * Jacob Leverich implemented the idea of this paper, and + * 'bvt_warp_ns' interface is derived from Leverich's code. + * Link: https://gist.github.com/leverich/5913713. + * + * Now we have reformed the whole idea, and only reserved + * the name of 'bvt_warp_ns' to be compalitible. + * + * 'bvt_warp_ns' will be converted into identity when written. + * The correspondence of bvt_warp_ns and identity follows: + * bvt identity value identity + * -2 9 ID_UNDERCLASS | ID_IDLE_SAVER + * -1 9 ID_UNDERCLASS | ID_IDLE_SAVER + * 0 0 ID_NORMAL + * 1 18 ID_HIGHCLASS | ID_IDLE_SEEKER + * 2 22 ID_HIGHCLASS | ID_IDLE_SEEKER | ID_SMT_EXPELLER + * + */ { .name = "bvt_warp_ns", .read_s64 = cpu_bvt_warp_ns_read_s64, diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index c9151b8732a15d..380df348cd57b0 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -112,6 +112,10 @@ unsigned int sysctl_sched_cfs_bandwidth_slice = 5000UL; #ifdef CONFIG_GROUP_IDENTITY /* + * Variable 'sysctl_sched_bvt_place_epsilon' is derived from + * https://gist.github.com/leverich/5913713. + * Author: Jacob Leverich + * * Waking batch tasks are placed sched_bvt_place_epsilon * nanoseconds relative to min_vruntime. * @@ -5290,6 +5294,10 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial) #ifdef CONFIG_GROUP_ENTITY /* + * The logic of punishing underclass is derived from + * https://gist.github.com/leverich/5913713. + * Author: Jacob Leverich + * * The runtime penalty for underclass wakee to make sure * they won't interrupt other's execution too much. */ diff --git a/kernel/sysctl.c b/kernel/sysctl.c index ae9ccdaabc6c68..89ddf0f7aa25e1 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -519,6 +519,11 @@ static struct ctl_table kern_table[] = { #endif #ifdef CONFIG_GROUP_IDENTITY { + /* + * Variable 'sysctl_sched_bvt_place_epsilon' is derived from + * https://gist.github.com/leverich/5913713. + * Author: Jacob Leverich + */ .procname = "sched_bvt_place_epsilon", .data = &sysctl_sched_bvt_place_epsilon, .maxlen = sizeof(unsigned int),