Skip to contentSkip to conversation

2.6.8-rc2-mm2 performance improvements (scheduler?)

DISCUSSION Andrew Theurer 3 participants 6 messages Aug 10, 2004 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 6 lines · you

Rick showed me schedstats graphs of the two ... it seems to have lower
latency, does less rebalancing, fewer pull_tasks, etc, etc. Everything looks better ... he'll send them out soon, I think (hint, hint).

Okay, they're done. Here's the URL of the graphs:

Quoted 8 lines

http://eaglet.rain.com/rick/linux/staircase/scase-vs-noscase.html

General summary: as Martin reported, we're seeing improvements in a number of areas, at least with sdet. The graphs as listed there represent stats from four separate sdet runs run sequentially with an increasing load. (We're trying to see if we can get the information from each run separately, rather than the aggregate -- one of the hazards of an automated test harness :)

What's quite interesting is that there is a very noticeable surge in load_balance with staircase in the early stage of the test, but there appears to be -no- direct policy changes to load-balance at all in Con's patch (or at least I didn't notice it -please tell me if you did!). You can see it in busy load_balance, sched_balance_exec, and pull_task. The runslice and latency stats confirm this -no-staircase does not balance early on, and the tasks suffer, waiting on a cpu already loaded up. I do not have an explanation for this; perhaps it has something to do with eliminating expired queue.

I would be nice to have per cpu runqueue lengths logged to see how this plays out -do the cpus on staircase obtain a runqueue length close to nr_running()/nr_online_cpus sooner than no-staircase?

Also, one big change apparent to me, the elimination of TIMESLICE_GRANULARITY. Do you have cswitch data? I would not be surprised if it's a lot higher on -no-staircase, and cache is thrashed a lot more. This may be something you can pull out of the -no-staircase kernel quite easily.

-Andrew Theurer

#2 lore raw
Quoted 9 lines · Andrew Theurer
Quoted 8 lines · you

Rick showed me schedstats graphs of the two ... it seems to have lower
latency, does less rebalancing, fewer pull_tasks, etc, etc. Everything looks better ... he'll send them out soon, I think (hint, hint).

Okay, they're done. Here's the URL of the graphs:

http://eaglet.rain.com/rick/linux/staircase/scase-vs-noscase.html

Quoted 8 lines
Quoted 6 lines

General summary: as Martin reported, we're seeing improvements in a number of areas, at least with sdet. The graphs as listed there represent stats from four separate sdet runs run sequentially with an increasing load. (We're trying to see if we can get the information from each run separately, rather than the aggregate -- one of the hazards of an automated test harness :)

What's quite interesting is that there is a very noticeable surge in load_balance with staircase in the early stage of the test, but there appears to be -no- direct policy changes to load-balance at all in Con's patch (or at least I didn't notice it -please tell me if you did!). You can see it in busy load_balance, sched_balance_exec, and pull_task. The runslice and latency stats confirm this -no-staircase does not balance early on, and the tasks suffer, waiting on a cpu already loaded up. I do not have an explanation for this; perhaps it has something to do with eliminating expired queue.

To be honest I have no idea why that's the case. One of the first things I did was eliminate the expired array and in my testing (up to 8x at osdl) I did not really notice this in and of itself made any big difference - of course this could be because the removal of the expired array was not done in a way which entitled starved tasks to run in reasonable timeframes.

Quoted 1 line

I would be nice to have per cpu runqueue lengths logged to see how this plays out -do the cpus on staircase obtain a runqueue length close to nr_running()/nr_online_cpus sooner than no-staircase?

/me looks in the schedstats peoples' way

Quoted 1 line

Also, one big change apparent to me, the elimination of TIMESLICE_GRANULARITY.

Ah well I tuned the timeslice granularity and I can tell you it isn't quite what most people think. The granularity when you get to greater than 4 cpus is effectively _disabled_. So in fact, the timeslices are shorter in staircase (in normal interactive=1, compute=0 mode which is how martin would have tested it), not longer. But this is not the reason either since in "compute" mode they are ten times longer and this also improves throughput further.

Quoted 3 lines

Do you have cswitch data? I would not be surprised if it's a lot higher on -no-staircase, and cache is thrashed a lot more. This may be something you can pull out of the -no-staircase kernel quite easily.

Well from what I got on 8x the optimal load (-j x4cpus) and maximal load (-j) on kernbench gives surprisingly similar context switch rates. It's only when I enable compute mode that the context switches drop compared to default staircase mode and mainline. You'd have to ask Martin and Rick about what they got.

Quoted 1 line

-Andrew Theurer

Cheers,
Con

#3 lore raw
Quoted 10 lines
Quoted 2 lines

Also, one big change apparent to me, the elimination of TIMESLICE_GRANULARITY.

Ah well I tuned the timeslice granularity and I can tell you it isn't quite what most people think. The granularity when you get to greater than 4 cpus is effectively _disabled_. So in fact, the timeslices are shorter in staircase (in normal interactive=1, compute=0 mode which is how martin would have tested it), not longer. But this is not the reason either since in "compute" mode they are ten times longer and this also improves throughput further.

Interesting, I forgot about the "* nr_cpus" that was in the granularity calculation. That does make me wonder, maybe the timeslices you are calculating could have something similar, but more appropriate.

Since the number of runnable tasks on a cpu should play a part in latency (the more tasks, potentially the longer the latency), I wonder if the timeslice would benefit from a modifier like " / task_cpu(p)->nr_running ". With this the base timeslice could be quite a bit larger to start for better cache warmth, and as we add more tasks to that cpu, the timeslices get smaller, so an acceptable latency is preserved.

Quoted 9 lines
Quoted 3 lines

Do you have cswitch data? I would not be surprised if it's a lot higher on -no-staircase, and cache is thrashed a lot more. This may be something you can pull out of the -no-staircase kernel quite easily.

Well from what I got on 8x the optimal load (-j x4cpus) and maximal load (-j) on kernbench gives surprisingly similar context switch rates. It's only when I enable compute mode that the context switches drop compared to default staircase mode and mainline. You'd have to ask Martin and Rick about what they got.

OK, thanks!

-Andrew Theurer

#4 lore raw
Quoted 12 lines · Andrew Theurer
Quoted 10 lines
Quoted 2 lines

Also, one big change apparent to me, the elimination of TIMESLICE_GRANULARITY.

Ah well I tuned the timeslice granularity and I can tell you it isn't quite what most people think. The granularity when you get to greater than 4 cpus is effectively _disabled_. So in fact, the timeslices are shorter in staircase (in normal interactive=1, compute=0 mode which is how martin would have tested it), not longer. But this is not the reason either since in "compute" mode they are ten times longer and this also improves throughput further.

Quoted 3 lines

Interesting, I forgot about the "* nr_cpus" that was in the granularity calculation. That does make me wonder, maybe the timeslices you are calculating could have something similar, but more appropriate.

Since the number of runnable tasks on a cpu should play a part in latency (the more tasks, potentially the longer the latency), I wonder if the timeslice would benefit from a modifier like " / task_cpu(p)->nr_running ". With this the base timeslice could be quite a bit larger to start for better cache warmth, and as we add more tasks to that cpu, the timeslices get smaller, so an acceptable latency is preserved.

I had a problem with fairness once I made the timeslices too long since that also determines priority demotion in the staircase design. That's why I have the "compute" mode as quite a separate entity because the longer timeslices on their own weren't of any special benefit (in my up to 8x testing but could be elsewhere) unless I added the delayed preemption which is probably where the main extra cache warmth comes from in "compute" design. Of course this comes at a cost which is higher latencies... because normal priority preemption is delayed.

Quoted 11 lines
Quoted 9 lines
Quoted 3 lines

Do you have cswitch data? I would not be surprised if it's a lot higher on -no-staircase, and cache is thrashed a lot more. This may be something you can pull out of the -no-staircase kernel quite easily.

Well from what I got on 8x the optimal load (-j x4cpus) and maximal load (-j) on kernbench gives surprisingly similar context switch rates. It's only when I enable compute mode that the context switches drop compared to default staircase mode and mainline. You'd have to ask Martin and Rick about what they got.

Quoted 3 lines

OK, thanks!

-Andrew Theurer

Cheers,
Con

#5 lore raw
In reply to Andrew Theurer

What's quite interesting is that there is a very noticeable surge in load_balance with staircase in the early stage of the test, but there appears to be -no- direct policy changes to load-balance at all in Con's patch (or at least I didn't notice it -please tell me if you did!). You can see it in busy load_balance, sched_balance_exec, and pull_task. The runslice and latency stats confirm this -no-staircase does not balance early on, and the tasks suffer, waiting on a cpu already loaded up. I do not have an explanation for this; perhaps it has something to do with eliminating expired queue.

Possibly. The other factor thrown in here is that this was on an SMT machine, so it's possible that the balancing is no different but we are seeing tasks initially assigned more poorly. Or, perhaps we're drawing too much from one data point.

It would be nice to have per cpu runqueue lengths logged to see how this plays out -do the cpus on staircase obtain a runqueue length close to nr_running()/nr_online_cpus sooner than no-staircase?

The only difficulty there is do we know how long it normally takes for this to balance out? We're taking samples every five seconds; might this not work itself out between one snapshot and the next? Shrug. It would be easy enough to add another field to report nr_running at the moment the statistics snapshot was taken, but on anything but compute-intensive benchmarks I'm afraid we might miss all the interesting data.

Also, one big change apparent to me, the elimination of TIMESLICE_GRANULARITY. Do you have cswitch data? I would not be surprised if it's a lot higher on -no-staircase, and cache is thrashed a lot more. This may be something you can pull out of the -no-staircase kernel quite easily.

Yes, sar data was collected every five seconds so I do have context switch data. The bad news is that it was collected for each of 10 runs times four different loads, and I don't have any handy dandy scripts to pretty it up :) (Pause.) A quick exercise with a calculator, though, suggests you are right. cswitches were 10%-20% higher on the no staircase runs.

Rick

#6 lore raw
Quoted 10 lines · Rick Lindsley

What's quite interesting is that there is a very noticeable surge in load_balance with staircase in the early stage of the test, but there appears to be -no- direct policy changes to load-balance at all in Con's patch (or at least I didn't notice it -please tell me if you did!). You can see it in busy load_balance, sched_balance_exec, and pull_task. The runslice and latency stats confirm this -no-staircase does not balance early on, and the tasks suffer, waiting on a cpu already loaded up. I do not have an explanation for this; perhaps it has something to do with eliminating expired queue.

Quoted 4 lines

Possibly. The other factor thrown in here is that this was on an SMT machine, so it's possible that the balancing is no different but we are seeing tasks initially assigned more poorly. Or, perhaps we're drawing too much from one data point.

Yes, my first guess was that sched_balance_exec was changed, and I guess it was, but earlier than Con's patch. The first conditional we had used to have:

if (this_rq()->nr_running <= 2)

                goto out;

but the 2 is now a 1 for both -rc2 and -rc2-mm2, so we tend to find the best cpu in the system more often now.

Quoted 11 lines

It would be nice to have per cpu runqueue lengths logged to see how this plays out -do the cpus on staircase obtain a runqueue length close to nr_running()/nr_online_cpus sooner than no-staircase?

The only difficulty there is do we know how long it normally takes for this to balance out? We're taking samples every five seconds; might this not work itself out between one snapshot and the next? Shrug. It would be easy enough to add another field to report nr_running at the moment the statistics snapshot was taken, but on anything but compute-intensive benchmarks I'm afraid we might miss all the interesting data.

Actually if you have sar cpu util data, we might be able to extract this. For example, if we have balance issues on 16 user sdet, we may see that very early on the staircase cpu util was near 100%, where the no-staircase may have been much lower for the first portion of the test (showing that some cpus were idle while others may have had more than one task). If we can see this in sar, IMO that would confirm some sort of indirect load balance improvement in staircase.

Quoted 11 lines

Also, one big change apparent to me, the elimination of TIMESLICE_GRANULARITY. Do you have cswitch data? I would not be surprised if it's a lot higher on -no-staircase, and cache is thrashed a lot more. This may be something you can pull out of the -no-staircase kernel quite easily.

Yes, sar data was collected every five seconds so I do have context switch data. The bad news is that it was collected for each of 10 runs times four different loads, and I don't have any handy dandy scripts to pretty it up :) (Pause.) A quick exercise with a calculator, though, suggests you are right. cswitches were 10%-20% higher on the no staircase runs.

Interesting. I wouldn't expect it to account for up to 20% performance, but maybe 1-2%.

Quoted 2 lines

Rick