Re: CFS: some bad numbers with Java/database threading [FIXED]

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Chuck Ebbert
Date: Tuesday, September 18, 2007 - 4:02 pm

On 09/18/2007 06:46 PM, Ingo Molnar wrote:

I just got a bug report today:

https://bugzilla.redhat.com/show_bug.cgi?id=295071

==================================================

Description of problem:

The CFS scheduler does not seem to implement sched_yield correctly. If one
program loops with a sched_yield and another program prints out timing
information in a loop. You will see that if both are taskset to the same core
that the timing stats will be twice as long as when they are on different cores.
This problem was not in 2.6.21-1.3194 but showed up in 2.6.22.4-65 and continues
in the newest released kernel 2.6.22.5-76. 

Version-Release number of selected component (if applicable):

2.6.22.4-65 through 2.6.22.5-76

How reproducible:

Very

Steps to Reproduce:
compile task1
int main() {
        while (1) {
            sched_yield();
        }
        return 0;
}

and compile task2

#include <stdio.h>
#include <sys/time.h>
int main() {
    while (1) {
        int i;
        struct timeval t0,t1;
        double usec;

        gettimeofday(&t0, 0);
        for (i = 0; i < 100000000; ++i)
            ;
        gettimeofday(&t1, 0);

        usec = (t1.tv_sec * 1e6 + t1.tv_usec) - (t0.tv_sec * 1e6 + t0.tv_usec);
        printf ("%8.0f\n", usec);
    }
    return 0;
}

Then run:
"taskset -c 0 ./task1"
"taskset -c 0 ./task2"

You will see that both tasks use 50% of the CPU. 
Then kill task2 and run:
"taskset -c 1 ./task2"

Now task2 will run twice as fast verifying that it is not some anomaly with the
way top calculates CPU usage with sched_yield.
  
Actual results:
Tasks with sched_yield do not yield like they are suppose to.

Expected results:
The sched_yield task's CPU usage should go to near 0% when another task is on
the same CPU.
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
CFS: some bad numbers with Java/database threading, Antoine Martin, (Wed Sep 12, 4:10 pm)
Re: some bad numbers with Java/database threading, Nick Piggin, (Wed Sep 12, 4:33 pm)
RE: some bad numbers with Java/database threading, David Schwartz, (Thu Sep 13, 12:18 am)
Re: CFS: some bad numbers with Java/database threading, Ingo Molnar, (Thu Sep 13, 4:24 am)
Re: some bad numbers with Java/database threading, Antoine Martin, (Thu Sep 13, 12:02 pm)
RE: some bad numbers with Java/database threading, David Schwartz, (Thu Sep 13, 2:47 pm)
Re: CFS: some bad numbers with Java/database threading, Ingo Molnar, (Fri Sep 14, 1:32 am)
Re: CFS: some bad numbers with Java/database threading, Satyam Sharma, (Fri Sep 14, 3:06 am)
Re: CFS: some bad numbers with Java/database threading, Satyam Sharma, (Fri Sep 14, 9:01 am)
Re: CFS: some bad numbers with Java/database threading, Satyam Sharma, (Fri Sep 14, 9:08 am)
Re: CFS: some bad numbers with Java/database threading, Antoine Martin, (Mon Sep 17, 5:17 am)
Re: CFS: some bad numbers with Java/database threading [FIXED], Chuck Ebbert, (Tue Sep 18, 4:02 pm)
Re: CFS: new java yield graphs, Antoine Martin, (Tue Sep 25, 6:46 pm)
Re: CFS: new java yield graphs, Ingo Molnar, (Thu Sep 27, 1:35 am)