> In sched_choosecpu_fork(), we see best_run is INT_MAX, the comparison below 
> actually reduces to a assignment ==> choice = ci;
> -               if (choice == NULL || run < best_run ||
> -                   (run == best_run &&load < best_load)) {
> -                       choice = ci;
> -                       best_load = load;
> -                       best_run = run;
> -               }
> 
> because run will always be less than INT_MAX + run can rarely be INT_MAX, and 
> choice is always NULL!
> 
> In sched_choosecpu(), last_cost is not being used where it could be useful. 
> Setting to INT_MAX, the comparison will always be false. This is like you can 
> safely delete sched_proc_to_cpu_cost() also. choice is again null.
> 
>               int cost = sched_proc_to_cpu_cost(ci, p);
> 
>               if (choice == NULL || cost < last_cost) {
>                       choice = ci;
>                       last_cost = cost;
>               }
>               cpuset_del(&set, ci);
> 

For the above I just realized this is only true for the first time in the loop, 
so please ignore this above part!

Reply via email to