svn commit: r310616 - head/sys/vm

Konstantin Belousov kib at FreeBSD.org
Mon Dec 26 19:29:06 UTC 2016


Author: kib
Date: Mon Dec 26 19:29:04 2016
New Revision: 310616
URL: https://svnweb.freebsd.org/changeset/base/310616

Log:
  Remove redundancy in vmtotal().
  
  There are two instances of inlined unlocks + continue in vmtotal()
  switch statements, which are ordinary expressed with break from the
  switch case and code after the switch.  Also, the combination of
  continue and break statement is redundand.
  
  Reviewed by:	alc
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/sys/vm/vm_meter.c

Modified: head/sys/vm/vm_meter.c
==============================================================================
--- head/sys/vm/vm_meter.c	Mon Dec 26 19:28:10 2016	(r310615)
+++ head/sys/vm/vm_meter.c	Mon Dec 26 19:29:04 2016	(r310616)
@@ -121,15 +121,10 @@ vmtotal(SYSCTL_HANDLER_ARGS)
 	 */
 	sx_slock(&allproc_lock);
 	FOREACH_PROC_IN_SYSTEM(p) {
-		if (p->p_flag & P_SYSTEM)
+		if ((p->p_flag & P_SYSTEM) != 0)
 			continue;
 		PROC_LOCK(p);
-		switch (p->p_state) {
-		case PRS_NEW:
-			PROC_UNLOCK(p);
-			continue;
-			break;
-		default:
+		if (p->p_state != PRS_NEW) {
 			FOREACH_THREAD_IN_PROC(p, td) {
 				thread_lock(td);
 				switch (td->td_state) {
@@ -146,15 +141,13 @@ vmtotal(SYSCTL_HANDLER_ARGS)
 							total.t_pw++;
 					}
 					break;
-
 				case TDS_CAN_RUN:
 					total.t_sw++;
 					break;
 				case TDS_RUNQ:
 				case TDS_RUNNING:
 					total.t_rq++;
-					thread_unlock(td);
-					continue;
+					break;
 				default:
 					break;
 				}


More information about the svn-src-all mailing list