On 22:47:08, 8.03.16, Martin Pieuchot wrote: > On 08/03/16(Tue) 10:01, Michal Mazurek wrote: > > p_cpu exists, but p_usrpri isn't based on it. > > Michal I lost track of all your comment fixes. One of the accepted > rules when we read code is that comments are always lying. So I doubt > anyone will object fixing them. > > Could you send a single diff with all your non-committed fixes?
Here is what I have. Index: sys/sys/sched.h =================================================================== RCS file: /cvs/src/sys/sys/sched.h,v retrieving revision 1.39 diff -u -p -r1.39 sched.h --- sys/sys/sched.h 13 Sep 2015 11:15:11 -0000 1.39 +++ sys/sys/sched.h 9 Mar 2016 08:34:19 -0000 @@ -139,7 +139,6 @@ void schedclock(struct proc *); struct cpu_info; void roundrobin(struct cpu_info *); void scheduler_start(void); -void updatepri(struct proc *); void userret(struct proc *p); void sched_init_cpu(struct cpu_info *); Index: sys/sys/proc.h =================================================================== RCS file: /cvs/src/sys/sys/proc.h,v retrieving revision 1.216 diff -u -p -r1.216 proc.h --- sys/sys/proc.h 6 Mar 2016 05:20:26 -0000 1.216 +++ sys/sys/proc.h 9 Mar 2016 08:34:19 -0000 @@ -323,7 +323,7 @@ struct proc { sigset_t p_sigmask; /* Current signal mask. */ u_char p_priority; /* Process priority. */ - u_char p_usrpri; /* User-priority based on p_cpu and ps_nice. */ + u_char p_usrpri; /* User-priority based on p_estcpu and ps_nice. */ char p_comm[MAXCOMLEN+1]; int p_pledge_syscall; /* Cache of current syscall */ Index: sys/kern/kern_synch.c =================================================================== RCS file: /cvs/src/sys/kern/kern_synch.c,v retrieving revision 1.128 diff -u -p -r1.128 kern_synch.c --- sys/kern/kern_synch.c 1 Feb 2016 23:34:31 -0000 1.128 +++ sys/kern/kern_synch.c 9 Mar 2016 08:34:19 -0000 @@ -59,7 +59,7 @@ #endif int thrsleep(struct proc *, struct sys___thrsleep_args *); - +int thrsleep_unlock(void *, int); /* * We're only looking at 7 bits of the address; everything is @@ -436,7 +436,6 @@ sys_sched_yield(struct proc *p, void *v, return (0); } -int thrsleep_unlock(void *, int); int thrsleep_unlock(void *lock, int lockflags) { Index: sys/kern/sched_bsd.c =================================================================== RCS file: /cvs/src/sys/kern/sched_bsd.c,v retrieving revision 1.42 diff -u -p -r1.42 sched_bsd.c --- sys/kern/sched_bsd.c 8 Nov 2015 20:45:57 -0000 1.42 +++ sys/kern/sched_bsd.c 9 Mar 2016 08:34:19 -0000 @@ -60,7 +60,8 @@ int rrticks_init; /* # of hardclock tic struct __mp_lock sched_lock; #endif -void schedcpu(void *); +void schedcpu(void *); +void updatepri(struct proc *); void scheduler_start(void) @@ -70,10 +71,9 @@ scheduler_start(void) /* * We avoid polluting the global namespace by keeping the scheduler * timeouts static in this function. - * We setup the timeouts here and kick schedcpu and roundrobin once to - * make them do their job. + * We setup the timeout here and kick schedcpu once to make it do + * its job. */ - timeout_set(&schedcpu_to, schedcpu, &schedcpu_to); rrticks_init = hz / 10; @@ -218,9 +218,7 @@ schedcpu(void *arg) LIST_FOREACH(p, &allproc, p_list) { /* - * Increment time in/out of memory and sleep time - * (if sleeping). We ignore overflow; with 16-bit int's - * (remember them?) overflow takes 45 days. + * Increment sleep time (if sleeping). We ignore overflow. */ if (p->p_stat == SSLEEP || p->p_stat == SSTOP) p->p_slptime++; @@ -233,7 +231,7 @@ schedcpu(void *arg) continue; SCHED_LOCK(s); /* - * p_pctcpu is only for ps. + * p_pctcpu is only for diagnostic tools such as ps. */ #if (FSHIFT >= CCPU_SHIFT) p->p_pctcpu += (phz == 100)? @@ -550,7 +548,6 @@ resetpriority(struct proc *p) * processes which haven't run much recently, and to round-robin among other * processes. */ - void schedclock(struct proc *p) { @@ -715,4 +712,3 @@ sysctl_hwperfpolicy(void *oldp, size_t * return 0; } #endif - Index: sys/kern/kern_sig.c =================================================================== RCS file: /cvs/src/sys/kern/kern_sig.c,v retrieving revision 1.192 diff -u -p -r1.192 kern_sig.c --- sys/kern/kern_sig.c 9 Jan 2016 06:13:43 -0000 1.192 +++ sys/kern/kern_sig.c 9 Mar 2016 08:34:19 -0000 @@ -896,7 +896,7 @@ ptsignal(struct proc *p, int signum, enu panic("psignal signal number"); #endif - /* Ignore signal if we are exiting */ + /* Ignore signal if the target process is exiting */ if (pr->ps_flags & PS_EXITING) return; @@ -980,7 +980,7 @@ ptsignal(struct proc *p, int signum, enu } else { action = SIG_DFL; - if (prop & SA_KILL && pr->ps_nice > NZERO) + if (prop & SA_KILL && pr->ps_nice > NZERO) pr->ps_nice = NZERO; /* -- Michal Mazurek