Re: update comment about p_usrpri

2016-03-09 Thread Michal Mazurek
On 09:42:32,  9.03.16, Michal Mazurek wrote:
> 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?

Sorry, I forgot one:


Index: sys/sys/sysctl.h
===
RCS file: /cvs/src/sys/sys/sysctl.h,v
retrieving revision 1.158
diff -u -p -r1.158 sysctl.h
--- sys/sys/sysctl.h29 Feb 2016 19:44:07 -  1.158
+++ sys/sys/sysctl.h9 Mar 2016 15:41:04 -
@@ -377,7 +377,7 @@ struct kinfo_proc {
 
int8_t  p_stat; /* CHAR: S* process status (from LWP). 
*/
u_int8_t p_priority;/* U_CHAR: Process priority. */
-   u_int8_t p_usrpri;  /* U_CHAR: User-priority based on p_cpu 
and ps_nice. */
+   u_int8_t p_usrpri;  /* U_CHAR: User-priority based on 
p_estcpu and ps_nice. */
u_int8_t p_nice;/* U_CHAR: Process "nice" value. */
 
u_int16_t p_xstat;  /* U_SHORT: Exit status for wait; also 
stop signal. */

-- 
Michal Mazurek



Re: update comment about p_usrpri

2016-03-09 Thread Michal Mazurek
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 -  1.39
+++ sys/sys/sched.h 9 Mar 2016 08:34:19 -
@@ -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 -   1.216
+++ sys/sys/proc.h  9 Mar 2016 08:34:19 -
@@ -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. 
*/
charp_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 -   1.128
+++ sys/kern/kern_synch.c   9 Mar 2016 08:34:19 -
@@ -59,7 +59,7 @@
 #endif
 
 intthrsleep(struct proc *, struct sys___thrsleep_args *);
-
+intthrsleep_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.c8 Nov 2015 20:45:57 -   1.42
+++ sys/kern/sched_bsd.c9 Mar 2016 08:34:19 -
@@ -60,7 +60,8 @@ int   rrticks_init;   /* # of hardclock tic
 struct __mp_lock sched_lock;
 #endif
 
-void schedcpu(void *);
+voidschedcpu(void *);
+voidupdatepri(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(_to, schedcpu, _to);
 
rrticks_init = hz / 10;
@@ -218,9 +218,7 @@ schedcpu(void *arg)
 
LIST_FOREACH(p, , 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 -   1.192
+++ sys/kern/kern_sig.c 9 Mar 2016 08:34:19 -
@@ -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 

Re: update comment about p_usrpri

2016-03-08 Thread Martin Pieuchot
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?