Bug 10545

Summary: sched_info_switch not being called according to documentation
Product: Process Management Reporter: David Simner (david)
Component: SchedulerAssignee: Ingo Molnar (mingo)
Status: RESOLVED CODE_FIX    
Severity: low CC: david
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.25 Subsystem:
Regression: --- Bisected commit-id:

Description David Simner 2008-04-24 05:35:30 UTC
sched_stats.h says that __sched_info_switch is "called when prev != next" in the comment.  sched.c should therefore do that, see the patch below:

--- sched.c     2008-04-17 03:49:44.000000000 +0100
+++ sched.c     2008-04-24 14:39:36.000000000 +0100
@@ -3944,9 +3944,9 @@
        prev->sched_class->put_prev_task(rq, prev);
        next = pick_next_task(rq, prev);
 
-       sched_info_switch(prev, next);
-
        if (likely(prev != next)) {
+               sched_info_switch(prev, next);
+
                rq->nr_switches++;
                rq->curr = next;
                ++*switch_count;
Comment 1 Ingo Molnar 2008-04-28 11:33:49 UTC
* bugme-daemon@bugzilla.kernel.org <bugme-daemon@bugzilla.kernel.org> wrote:

> --- sched.c     2008-04-17 03:49:44.000000000 +0100
> +++ sched.c     2008-04-24 14:39:36.000000000 +0100

fair enough - please send the patch to lkml.org (and Cc: me if 
possible), thanks.

	Ingo
Comment 2 Ingo Molnar 2008-05-06 23:37:54 UTC
fixed upstream by:

| commit 673a90a1e05c8127886f7659d1a457169378371f
| Author: David Simner <djs203@srcf.ucam.org>
| Date:   Tue Apr 29 10:08:59 2008 +0100
|
|     sched: fix sched_info_switch not being called according to documentation