kern/72560: small cleanup of SCHED_ULE

Divacky Roman xdivac02 at stud.fit.vutbr.cz
Tue Oct 12 00:40:24 PDT 2004


>Number:         72560
>Category:       kern
>Synopsis:       small cleanup of SCHED_ULE
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 12 07:40:17 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Divacky Roman
>Release:        FreeBSD 6.0-CURRENT i386
>Organization:
home
>Environment:
FreeBSD witten 6.0-CURRENT FreeBSD 6.0-CURRENT #139: Sat Oct  9 12:37:22 CEST
2004     root at witten:/usr/obj/usr/src/sys/NEOLOGISM  i386


	
>Description:
Small cleanup of sched_ule.c, some things are unecessary, some juts ugly. This
patch identifies a few and (tries to) repair them.
>How-To-Repeat:
	Apply this
>Fix:
--- sched_ule.c	Wed Oct  6 00:14:02 2004
+++ /root/sched_ule.c	Sat Oct  9 14:51:35 2004
@@ -526,14 +526,12 @@
 	struct kseq_group *low;
 	struct kseq_group *ksg;
 	int cnt;
-	int i;
 
 	if (smp_started == 0)
 		goto out;
 	low = high = NULL;
-	i = random() % (ksg_maxid + 1);
 	for (cnt = 0; cnt <= ksg_maxid; cnt++) {
-		ksg = KSEQ_GROUP(i);
+		ksg = KSEQ_GROUP(cnt);
 		/*
 		 * Find the CPU with the highest load that has some
 		 * threads to transfer.
@@ -543,8 +541,6 @@
 			high = ksg;
 		if (low == NULL || ksg->ksg_load < low->ksg_load)
 			low = ksg;
-		if (++i > ksg_maxid)
-			i = 0;
 	}
 	if (low != NULL && high != NULL && high != low)
 		sched_balance_pair(LIST_FIRST(&high->ksg_members),
@@ -575,8 +571,7 @@
 
 	if (ksg->ksg_transferable == 0)
 		return;
-	low = NULL;
-	high = NULL;
+	low = high = NULL;
 	LIST_FOREACH(kseq, &ksg->ksg_members, ksq_siblings) {
 		load = kseq->ksq_load;
 		if (high == NULL || load > high->ksq_load)
@@ -625,7 +624,6 @@
 	move = min(move, transferable);
 	for (i = 0; i < move; i++)
 		kseq_move(high, KSEQ_ID(low));
-	return;
 }
 
 static void
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list