[Gllug] Tuning the CPU scheduler

- Tethys tethys at gmail.com
Tue Oct 27 14:03:19 UTC 2009


Basically, modern day Linux sucks, and I'm fed up with it. In the
past, I could, y'know, do multiple things at once and the machine
coped just fine. Now, though, any time you open multiple images in
GIMP, switch to a different tab in Firefox, or even just bring a
window to the front or any number of other not particularly taxing
tasks, the machine shows noticeable lag. Windows don't redraw for a
few seconds, music playback sometimes stutters, and other undesirable
symptoms.

I have plenty of memory, and the box isn't swapping at all, so that's
not the problem. Latencytop shows that most of the latency on my box
is the scheduler waiting for cpu. Now I could try BFS, and see if that
makes a difference. But every time it's brought up, someone else
mentions that there's no need for it, because CFS is already
sufficiently tunable. The problem is, I don't know how.

Ingo's initial CFS announcement mentioned a single tunable,
sched_granularity_ns. Of course, that no longer exists, so that
doesn't really help. What I do have (and their current values) are:

	mrburns:~# sysctl -a | grep sched | grep -v domain
	kernel.sched_min_granularity_ns = 8000000
	kernel.sched_latency_ns = 40000000
	kernel.sched_wakeup_granularity_ns = 10000000
	kernel.sched_shares_ratelimit = 500000
	kernel.sched_shares_thresh = 4
	kernel.sched_child_runs_first = 1
	kernel.sched_features = 113917
	kernel.sched_migration_cost = 500000
	kernel.sched_nr_migrate = 32
	kernel.sched_rt_period_us = 1000000
	kernel.sched_rt_runtime_us = 950000
	kernel.sched_compat_yield = 0

I believe that sched_min_granularity_ns and sched_latency_ns are the
two to play with (I don't know if that's true of not, but it's the
best I could glean from the combined wisdom of the web).

The problem is, even if I've correctly identified the parameters to
tweak, I have no idea what to do with them. Should I be increasing
them? Decreasing them? One up, one down? And by how much? I'm not a
scheduler guru, and there seems to be precious little documentation
available.

So basically, does anyone know what I should be tuning and how I
should be tuning it in order to improve responsiveness on a desktop
machine?

Tet

-- 
“It seems intuitively obvious to me, which means that it might be
wrong.” -- Chris Torek
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


More information about the GLLUG mailing list