hamadmarri / TT-CPU-Scheduler

Task Type (TT) is an alternative CPU Scheduler for linux.
107 stars 12 forks source link

`arch_asym_cpu_priority` undefined #1

Closed raykzhao closed 2 years ago

raykzhao commented 2 years ago

Hi @hamadmarri,

Thank you for continuing development of alternative Linux kernel schedulers.

When I tried to compile the kernel with the tt-5.14.patch, I got the following errors during linking:

ld: kernel/sched/bs.o: in function `trigger_load_balance':
bs.c:(.text+0x601b): undefined reference to `arch_asym_cpu_priority'
ld: bs.c:(.text+0x6026): undefined reference to `arch_asym_cpu_priority'
ld: kernel/sched/topology.o: in function `build_sched_domains':
topology.c:(.text+0x1c27): undefined reference to `arch_asym_cpu_priority'
ld: topology.c:(.text+0x1c31): undefined reference to `arch_asym_cpu_priority'
make: *** [Makefile:1180: vmlinux] Error 1

I guess this is used in sched_asym_prefer when NO_HZ is enabled. Here I also attach my kernel config file. config.zip

hamadmarri commented 2 years ago

Hi @raykzhao

Could you please try the fix below:

diff --git a/kernel/sched/bs.h b/kernel/sched/bs.h
index 8e534147b428..e3a6e2f3621c 100644
--- a/kernel/sched/bs.h
+++ b/kernel/sched/bs.h
@@ -10,6 +10,14 @@ const_debug unsigned int sysctl_sched_migration_cost = 500000UL;
 void __init sched_init_granularity(void) {}

 #ifdef CONFIG_SMP
+/*
+ * For asym packing, by default the lower numbered CPU has higher priority.
+ */
+int __weak arch_asym_cpu_priority(int cpu)
+{
+       return -cpu;
+}
+
 /* Give new sched_entity start runnable values to heavy its load in infant time */
 void init_entity_runnable_average(struct sched_entity *se) {}
 void post_init_entity_util_avg(struct task_struct *p) {}

Glad to see you testing this new scheduler :D

raykzhao commented 2 years ago

It works! Thank you!