Lines Matching refs:procp

649 static bool claim_record(struct proc* procp, pid_t pid) {  in claim_record()  argument
650 if (procp->reg_pid == pid) { in claim_record()
654 if (procp->reg_pid == 0) { in claim_record()
656 procp->reg_pid = pid; in claim_record()
667 struct proc* procp = pidhash[i]; in remove_claims() local
668 while (procp) { in remove_claims()
669 if (procp->reg_pid == pid) { in remove_claims()
670 procp->reg_pid = 0; in remove_claims()
672 procp = procp->pidhash_next; in remove_claims()
820 struct proc *procp; in pid_lookup() local
822 for (procp = pidhash[pid_hashfn(pid)]; procp && procp->pid != pid; in pid_lookup()
823 procp = procp->pidhash_next) in pid_lookup()
826 return procp; in pid_lookup()
852 static void proc_slot(struct proc *procp) { in proc_slot() argument
853 int adjslot = ADJTOSLOT(procp->oomadj); in proc_slot()
855 adjslot_insert(&procadjslot_list[adjslot], &procp->asl); in proc_slot()
858 static void proc_unslot(struct proc *procp) { in proc_unslot() argument
859 adjslot_remove(&procp->asl); in proc_unslot()
862 static void proc_insert(struct proc *procp) { in proc_insert() argument
863 int hval = pid_hashfn(procp->pid); in proc_insert()
865 procp->pidhash_next = pidhash[hval]; in proc_insert()
866 pidhash[hval] = procp; in proc_insert()
867 proc_slot(procp); in proc_insert()
872 struct proc *procp; in pid_remove() local
875 for (procp = pidhash[hval], prevp = NULL; procp && procp->pid != pid; in pid_remove()
876 procp = procp->pidhash_next) in pid_remove()
877 prevp = procp; in pid_remove()
879 if (!procp) in pid_remove()
883 pidhash[hval] = procp->pidhash_next; in pid_remove()
885 prevp->pidhash_next = procp->pidhash_next; in pid_remove()
887 proc_unslot(procp); in pid_remove()
892 if (procp->pidfd >= 0 && procp->pidfd != last_kill_pid_or_fd) { in pid_remove()
893 close(procp->pidfd); in pid_remove()
895 free(procp); in pid_remove()
1030 struct proc *procp; in cmd_procprio() local
1122 procp = pid_lookup(params.pid); in cmd_procprio()
1123 if (!procp) { in cmd_procprio()
1134 procp = static_cast<struct proc*>(calloc(1, sizeof(struct proc))); in cmd_procprio()
1135 if (!procp) { in cmd_procprio()
1140 procp->pid = params.pid; in cmd_procprio()
1141 procp->pidfd = pidfd; in cmd_procprio()
1142 procp->uid = params.uid; in cmd_procprio()
1143 procp->reg_pid = cred->pid; in cmd_procprio()
1144 procp->oomadj = params.oomadj; in cmd_procprio()
1145 proc_insert(procp); in cmd_procprio()
1147 if (!claim_record(procp, cred->pid)) { in cmd_procprio()
1154 proc_unslot(procp); in cmd_procprio()
1155 procp->oomadj = params.oomadj; in cmd_procprio()
1156 proc_slot(procp); in cmd_procprio()
1162 struct proc *procp; in cmd_procremove() local
1179 procp = pid_lookup(params.pid); in cmd_procremove()
1180 if (!procp) { in cmd_procremove()
1184 if (!claim_record(procp, cred->pid)) { in cmd_procremove()
1201 struct proc *procp; in cmd_procpurge() local
1210 procp = pidhash[i]; in cmd_procpurge()
1211 while (procp) { in cmd_procpurge()
1212 next = procp->pidhash_next; in cmd_procpurge()
1214 if (claim_record(procp, cred->pid)) { in cmd_procpurge()
1215 pid_remove(procp->pid); in cmd_procpurge()
1217 procp = next; in cmd_procpurge()
1857 static void killinfo_log(struct proc* procp, int min_oom_score, int tasksize, in killinfo_log() argument
1861 android_log_write_int32(ctx, procp->pid); in killinfo_log()
1862 android_log_write_int32(ctx, procp->uid); in killinfo_log()
1863 android_log_write_int32(ctx, procp->oomadj); in killinfo_log()
2044 static int kill_one_process(struct proc* procp, int min_oom_score, int kill_reason, in kill_one_process() argument
2047 int pid = procp->pid; in kill_one_process()
2048 int pidfd = procp->pidfd; in kill_one_process()
2049 uid_t uid = procp->uid; in kill_one_process()
2100 inc_killcnt(procp->oomadj); in kill_one_process()
2102 killinfo_log(procp, min_oom_score, tasksize, kill_reason, mi, wi, tm); in kill_one_process()
2106 uid, procp->oomadj, tasksize * page_k, kill_desc); in kill_one_process()
2109 uid, procp->oomadj, tasksize * page_k); in kill_one_process()
2112 stats_write_lmk_kill_occurred(uid, taskname, procp->oomadj, min_oom_score, tasksize, mem_st); in kill_one_process()
2138 struct proc *procp; in find_and_kill_process() local
2141 procp = kill_heaviest_task ? in find_and_kill_process()
2144 if (!procp) in find_and_kill_process()
2147 killed_size = kill_one_process(procp, min_score_adj, kill_reason, kill_desc, in find_and_kill_process()