Lines Matching +full:- +full:p1
1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
40 * Returns 1 if p2 is "better" than p1
44 * 1) Only foreground processes are eligible - implied.
49 * we pick out just "short-term" sleepers (TDF_SINTR == 0).
55 * TODO - consider whether pctcpu should be used.
58 #define ISRUN(p) (((p)->ki_stat == SRUN) || ((p)->ki_stat == SIDL))
65 proc_compare(struct kinfo_proc *p1, struct kinfo_proc *p2) in proc_compare() argument
68 if (p1 == NULL) in proc_compare()
73 switch (TESTAB(ISRUN(p1), ISRUN(p2))) { in proc_compare()
80 * tie - favor one with highest recent cpu utilization in proc_compare()
82 if (p2->ki_estcpu > p1->ki_estcpu) in proc_compare()
84 if (p1->ki_estcpu > p2->ki_estcpu) in proc_compare()
86 return (p2->ki_pid > p1->ki_pid); /* tie - return highest pid */ in proc_compare()
91 switch (TESTAB(p1->ki_stat == SZOMB, p2->ki_stat == SZOMB)) { in proc_compare()
97 return (p2->ki_pid > p1->ki_pid); /* tie - return highest pid */ in proc_compare()
102 if (p2->ki_slptime > p1->ki_slptime) in proc_compare()
104 if (p1->ki_slptime > p2->ki_slptime) in proc_compare()
107 * favor one sleeping in a non-interruptible sleep in proc_compare()
109 if (p1->ki_tdflags & TDF_SINTR && (p2->ki_tdflags & TDF_SINTR) == 0) in proc_compare()
111 if (p2->ki_tdflags & TDF_SINTR && (p1->ki_tdflags & TDF_SINTR) == 0) in proc_compare()
113 return (p2->ki_pid > p1->ki_pid); /* tie - return highest pid */ in proc_compare()