Quoting Tvrtko Ursulin (2021-01-22 11:55:24) > +static int client_cmp(const void *_a, const void *_b) > +{ > + const struct client *a = _a; > + const struct client *b = _b; > + long tot_a, tot_b; > + > + /* > + * Sort clients in descending order of runtime in the previous sampling > + * period for active ones, followed by inactive. Tie-breaker is client > + * id. > + */ > + > + tot_a = a->status == ALIVE ? a->total : -1; > + tot_b = b->status == ALIVE ? b->total : -1; > + > + tot_b -= tot_a; > + if (!tot_b) > + return (int)b->id - a->id; > + > + if (tot_b > 0) > + return 1; > + if (tot_b < 0) > + return -1; > + return 0; Nit, this is clearly now if (tot_b > 0) return 1; if (tot_b < 0) return -1; return (int)b->id - a->id; And the decision flow now neatly matches the comment. -Chris _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx