From owner-svn-src-all@freebsd.org Sun Feb 25 00:35:22 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B349EF3081B; Sun, 25 Feb 2018 00:35:22 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 66A957FAF5; Sun, 25 Feb 2018 00:35:22 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C93F2CF2F; Sun, 25 Feb 2018 00:35:22 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1P0ZMJE009956; Sun, 25 Feb 2018 00:35:22 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1P0ZMI1009955; Sun, 25 Feb 2018 00:35:22 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201802250035.w1P0ZMI1009955@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Sun, 25 Feb 2018 00:35:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329943 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 329943 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Feb 2018 00:35:22 -0000 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"); }