Hi, In uts/common/disp/disp.c, above setbackdq() there is this comment:
/* * setbackdq() keeps runqs balanced such that the difference in length * between the chosen runq and the next one is no more than RUNQ_MAX_DIFF. * For threads with priorities below RUNQ_MATCH_PRI levels, the runq's lengths * must match. When per-thread TS_RUNQMATCH flag is set, setbackdq() will * try to keep runqs perfectly balanced regardless of the thread priority. */ #define RUNQ_MATCH_PRI 16 /* pri below which queue lengths must match */ #define RUNQ_MAX_DIFF 2 /* maximum runq length difference */ #define RUNQ_LEN(cp, pri) ((cp)->cpu_disp->disp_q[pri].dq_sruncnt) What is meant with "between the chosen runq and the next one"? Does this mean that in the balancing only two queues will be checked? This means that there can be a great imbalance between two other cpu's right? Suppose cpu0 has 2 threads, cpu1 can then have 4, cpu2 can have 6 and cpu3 can have 8. Between cpu3 and cpu0 there is now a difference of 6 threads on their queues. A more balanced situation would be for each of these cpus to have 5 threads. In case only the 'next' cpu is checked, when the 'next' one is in the P_OFFLINE state, will it still be considered next, or will only active cpus be looked at? We are currently implementing a processor shutdown strategy. For debugging purposes, the strategy prints out the run queues at each of its invocations (each 10ms = 1 os tick). Something that is often seen is a situation like this: Jun 2 07:01:01 sarek.network.sim periodic_shutdown: NOTICE: thresh_queue(): [793] disp_nrunnable | 2:0 | 3:3 | Jun 2 07:01:01 sarek.network.sim periodic_shutdown: NOTICE: thresh_queue(): [794] disp_nrunnable | 2:0 | 3:3 | Jun 2 07:01:01 sarek.network.sim periodic_shutdown: NOTICE: thresh_queue(): [795] disp_nrunnable | 2:0 | 3:4 | Jun 2 07:01:01 sarek.network.sim periodic_shutdown: NOTICE: thresh_queue(): [796] disp_nrunnable | 2:0 | 3:4 | Jun 2 07:01:01 sarek.network.sim periodic_shutdown: NOTICE: thresh_queue(): [797] disp_nrunnable | 2:0 | 3:4 | Jun 2 07:01:01 sarek.network.sim periodic_shutdown: NOTICE: thresh_queue(): [798] disp_nrunnable | 2:0 | 3:4 | The numbers are in format cpuid:totalqueuelength. Total queue length is taken as the disp_nrunnable variable. I do not understand why the four threads on cpu3 are not balanced to cpu2, who is currently doing nothing. Cpu0 and cpu1 are currently offline. Is there something I am missing here? Thanks, Thomas _______________________________________________ opensolaris-code mailing list [email protected] http://mail.opensolaris.org/mailman/listinfo/opensolaris-code
