What I have done this week
When selecting an idle CPU that should wake up because a thread is waking up, I now consider the cpu group of the cpu where the waking thread was last running. The cpu topology is handled in FreeBSD by cpu groups. The idea is simple – cores of a single CPU are in the same group. The groups are organized hierarchically – because CPU caches are hierarchical. The CPUs in a single group usually share some level of cache. So what I do is basically this – I have a CPU where the thread was running last time. I look if there is any idle CPU in the cpu group of this cpu. If yes, I wake that idle CPU. If not, I check the same thing, but only one hierarchy higher. I do this until I find a suitable idle cpu or I reach the top of the CPU group hierarchy. The similar concept is used in the ULE scheduler, and from there I tried to figure out how this CPU topology API works in the FreeBSD kernel.
I have also taken a look at the dtrace in FreeBSD. This is a wonderful tool that lets me analyze how much time the kernel spends in various functions of my scheduler. I have started learning this tool and made some example scripts. I think I will sometimes publish here an analysis of how much time the kernel spends in the functions of the FBFS scheduler and the corresponding functions of the ULE scheduler.
The midterm evaluation of my work at gsoc is due next week and so I publish here a patch to the FreeBSD kernel that contains my work so far. Currently I am working on a live CD that will contain my scheduler already compiled into the kernel. I will publish this live CD here in a few days. I will then also write here a quick guide how to apply my patch to the FreeBSD kernel. For now, I just tell you this patch is over the FreeBSD kernel from the stable branch with tag RELENG_8_2. The patch is here. So if you are confident enough, you can try it on your own. Or wait a few days until I finish the work on the live cd. Then you can try the cd or read my quick guide how to apply my patch. Any feedback will be welcome:-)
What I will do next week
Firstly I will finish work on the live cd with the latest version of the FBFS scheduler. Then I will run similar benchmarks as I run at the beginning of the project. I will publish here the results.