From owner-svn-src-user@freebsd.org Fri Feb 9 00:38:51 2018 Return-Path: Delivered-To: svn-src-user@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 9953CF13F6E for ; Fri, 9 Feb 2018 00:38:51 +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 4C08187E9A; Fri, 9 Feb 2018 00:38:51 +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 42F861D8A9; Fri, 9 Feb 2018 00:38:51 +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 w190cp67064555; Fri, 9 Feb 2018 00:38:51 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w190cprh064554; Fri, 9 Feb 2018 00:38:51 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201802090038.w190cprh064554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Fri, 9 Feb 2018 00:38:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r329055 - user/jeff/numa/sys/kern X-SVN-Group: user X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: user/jeff/numa/sys/kern X-SVN-Commit-Revision: 329055 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Feb 2018 00:38:51 -0000 Author: jeff Date: Fri Feb 9 00:38:50 2018 New Revision: 329055 URL: https://svnweb.freebsd.org/changeset/base/329055 Log: Eliminate the use of cmpxchg for bufspace management. This eliminates the time wasted by fighting cmpxchg loops. Modified: user/jeff/numa/sys/kern/vfs_bio.c Modified: user/jeff/numa/sys/kern/vfs_bio.c ============================================================================== --- user/jeff/numa/sys/kern/vfs_bio.c Fri Feb 9 00:36:55 2018 (r329054) +++ user/jeff/numa/sys/kern/vfs_bio.c Fri Feb 9 00:38:50 2018 (r329055) @@ -535,12 +535,12 @@ bufspace_reserve(struct bufdomain *bd, int size, bool limit = bd->bd_maxbufspace; else limit = bd->bd_hibufspace; - do { - space = bd->bd_bufspace; - new = space + size; - if (new > limit) - return (ENOSPC); - } while (atomic_cmpset_long(&bd->bd_bufspace, space, new) == 0); + space = atomic_fetchadd_long(&bd->bd_bufspace, size); + new = space + size; + if (new > limit) { + atomic_subtract_long(&bd->bd_bufspace, size); + return (ENOSPC); + } /* Wake up the daemon on the transition. */ if (space < bd->bd_bufspacethresh && new >= bd->bd_bufspacethresh)