Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Feb 2018 00:35:22 +0000 (UTC)
From:      Jeff Roberson <jeff@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r329943 - head/sys/kern
Message-ID:  <201802250035.w1P0ZMI1009955@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jeff
Date: Sun Feb 25 00:35:21 2018
New Revision: 329943
URL: https://svnweb.freebsd.org/changeset/base/329943

Log:
  Fix issues with sparse cpu allocation.  Consistently use mp_maxid + 1.
  
  Reported by:	pho
  Reviewed by:	markj
  Sponsored by:	Netflix, Dell/EMC Isilon

Modified:
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/vfs_bio.c
==============================================================================
--- head/sys/kern/vfs_bio.c	Sun Feb 25 00:32:42 2018	(r329942)
+++ head/sys/kern/vfs_bio.c	Sun Feb 25 00:35:21 2018	(r329943)
@@ -1041,7 +1041,7 @@ bufinit(void)
 		bp->b_wcred = NOCRED;
 		bp->b_qindex = QUEUE_NONE;
 		bp->b_domain = -1;
-		bp->b_subqueue = mp_ncpus;
+		bp->b_subqueue = mp_maxid + 1;
 		bp->b_xflags = 0;
 		bp->b_data = bp->b_kvabase = unmapped_buf;
 		LIST_INIT(&bp->b_dep);
@@ -1716,8 +1716,8 @@ bd_init(struct bufdomain *bd)
 	int i;
 
 	domain = bd - bdclean;
-	bd->bd_cleanq = &bd->bd_subq[mp_ncpus];
-	bq_init(bd->bd_cleanq, QUEUE_CLEAN, mp_ncpus, "bufq clean lock");
+	bd->bd_cleanq = &bd->bd_subq[mp_maxid + 1];
+	bq_init(bd->bd_cleanq, QUEUE_CLEAN, mp_maxid + 1, "bufq clean lock");
 	for (i = 0; i <= mp_maxid; i++)
 		bq_init(&bd->bd_subq[i], QUEUE_CLEAN, i,
 		    "bufq clean subqueue lock");
@@ -1765,7 +1765,7 @@ bd_flush(struct bufdomain *bd, struct bufqueue *bq)
 			TAILQ_REMOVE(&bq->bq_queue, bp, b_freelist);
 			TAILQ_INSERT_TAIL(&bd->bd_cleanq->bq_queue, bp,
 			    b_freelist);
-			bp->b_subqueue = mp_ncpus;
+			bp->b_subqueue = bd->bd_cleanq->bq_subqueue;
 		}
 		bd->bd_cleanq->bq_len += bq->bq_len;
 		bq->bq_len = 0;
@@ -1788,7 +1788,7 @@ bd_flushall(struct bufdomain *bd)
 	if (bd->bd_lim == 0)
 		return (0);
 	flushed = 0;
-	for (i = 0; i < mp_maxid; i++) {
+	for (i = 0; i <= mp_maxid; i++) {
 		bq = &bd->bd_subq[i];
 		if (bq->bq_len == 0)
 			continue;
@@ -5202,7 +5202,7 @@ DB_SHOW_COMMAND(bufqueues, bufqueues)
 		db_printf("\twakeup\t\t%d\n", bd->bd_wanted);
 		db_printf("\tlim\t\t%d\n", bd->bd_lim);
 		db_printf("\tCPU ");
-		for (j = 0; j < mp_maxid + 1; j++)
+		for (j = 0; j <= mp_maxid; j++)
 			db_printf("%d, ", bd->bd_subq[j].bq_len);
 		db_printf("\n");
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802250035.w1P0ZMI1009955>