Skip to content

Instantly share code, notes, and snippets.

View johnstultz-work's full-sized avatar

John Stultz johnstultz-work

View GitHub Profile
@johnstultz-work
johnstultz-work / testing-linux-scheduler.md
Last active November 21, 2025 05:02
How I test and debug the Linux kernel scheduler

How I test and debug the Linux kernel scheduler

For my work on proxy-exec, I’ve built up a collection of tests that I use to try to strain things and uncover issues. I’m sure there are lots of better ways, however I am but a simple caveman. Folks have asked about my process so I figured I'd try to document it. I’m likely forgetting things, but I’ll try to update as I think of them.

General configs that are useful to enable to find bugs

(I'll usually keep a custom test defconfig in my kerenl trees that have the options I see as useful/helpful enabled so others can re-create the same config easily):

CONFIG_PROVE_LOCKING

Perfetto for upstream kernel development

Perfetto is super useful for understanding interactions between the kernel and applications. Outside of Android and ChromeOS, though it's use isn't as common. This doc tries to provide a basic walk through to get started using perfetto for upstream kernel development with classic linux distros, potentially running under qemu.

Install perfetto

Grab the latest linux- tarball: https://github.com/google/perfetto/releases

Often the tests I’m tracing need to run as root, so because of this, I copied the binaries in the tarball to /usr/local/bin/ and chmod +x the binaries to make