From nobody Mon Jan 31 02:46:53 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A492B197F687; Mon, 31 Jan 2022 02:46:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JnCBj4975z3FGt; Mon, 31 Jan 2022 02:46:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643597213; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cZFSeJhOxeyCaxOslwIJoWQd/EIVv7IaD0L7U/d8HLs=; b=jG9QjsoypiRHyk54B2F04M4P9s4+CPILoNo6qopCdOCA4ckQjZeo+WrGjvaPtcADFE+VH1 M7JGDXT3sPd33eg7wRfJ15mymHE0S4GypxCQ9VMIQ772+NU9tk2pEsBIHcAf0I/cRWwLwC vdzGLa1oBxG+toVD8g1XlPqbrTxLiu5gPCHPOpiNEtuZMgQdg/BuLLRacfUmAus1yMwWP+ Va30F+18m63vl/0De+HY7aoas+Bo2kTtK4J2l9ohIw00CO8SCrQZgfOd3SNEL7o57aNUZ+ yxfEWHRklhhBS+tj+rjtQgt26r/24ADQ9NkOP6HInjmLN6yJr7twMw5iNzp0/A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F544143FD; Mon, 31 Jan 2022 02:46:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 20V2krtB009041; Mon, 31 Jan 2022 02:46:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20V2krHE009040; Mon, 31 Jan 2022 02:46:53 GMT (envelope-from git) Date: Mon, 31 Jan 2022 02:46:53 GMT Message-Id: <202201310246.20V2krHE009040@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 531f8cfea06b - main - Use dedicated lock name for pbufs List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 531f8cfea06b689b6c17219faa3e67977958b0c0 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643597213; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=cZFSeJhOxeyCaxOslwIJoWQd/EIVv7IaD0L7U/d8HLs=; b=lP3uBuscqfwtvDCWIG1tNSAK358SAdRb+SzzrWHm6jnkE0eXuCjNpxRTGtdWy7bua+Q2ge 80d73ly3kipIvo/WDbUEUiDVOBoAA4TqOxj5r5txGSp5u4XJb912glsdeZ+aXyhpbaZHzt yZqoE3dr6fqiKfxypvji1ci/56p088fZZOadUHuj8jb0TXIgPY4f6IPTGkkurXU8L4YN4i v9lFnsVH5tnNsxpV5SjyxSc+DX0M8lTMKXGGlatFedOfSrXLaL8QZC+4FV412qVePlTTyq AfZNUwjSHjY7ry93f28T9UyyBwUNc4Ql3gBCNtk6+0v+6BgSMq8kiWrWra5QCw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643597213; a=rsa-sha256; cv=none; b=OR3vYMYYjqLWrs9IbLNE6Pii3AYKvb91/7h9oZjZmK/0LmIiurrmI+qxLE8mBoWcAo5z7v +G0SWHaYEhpKDurnTVER0iY2JwXTIxVZA01lrbKA8Y2y2muperfn7V6BSSYe7BIOBpRUis 07fh9WFsfqSplAaI6JTOnYQPTn5HY0NiYskX626RMyxwJm3Aqo3QKjpOgHlRerQCc8BqYB X1oFA8l8CyAxzO6eJyiE2x8utq9vZhLxzUShPUL7ij34YqMSx5mj7EMyhvAE9i0STWZ2IR 87D8kETNru+2nwmdL81TImewhTvD1Z+RsAv519NtStzCWF/UlvT3he1dAqqcZA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=531f8cfea06b689b6c17219faa3e67977958b0c0 commit 531f8cfea06b689b6c17219faa3e67977958b0c0 Author: Konstantin Belousov AuthorDate: 2022-01-23 00:24:12 +0000 Commit: Konstantin Belousov CommitDate: 2022-01-31 02:46:14 +0000 Use dedicated lock name for pbufs Also remove a pointer to array variable, use array address directly. Reviewed by: markj, mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D34072 --- sys/kern/vfs_bio.c | 14 +++++++------- sys/sys/buf.h | 6 ++---- sys/vm/vm_pager.c | 4 +++- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index ce7f860f1ffe..0cf02a95729c 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -400,12 +400,6 @@ struct bufqueue __exclusive_cache_line bqempty; */ uma_zone_t buf_zone; -/* - * Single global constant for BUF_WMESG, to avoid getting multiple references. - * buf_wmesg is referred from macros. - */ -const char *buf_wmesg = BUF_WMESG; - static int sysctl_runningspace(SYSCTL_HANDLER_ARGS) { @@ -1184,6 +1178,12 @@ kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est) return (v); } +/* + * Single global constant for BUF_WMESG, to avoid getting multiple + * references. + */ +static const char buf_wmesg[] = "bufwait"; + /* Initialize the buffer subsystem. Called before use of any buffers. */ void bufinit(void) @@ -1214,7 +1214,7 @@ bufinit(void) bp->b_xflags = 0; bp->b_data = bp->b_kvabase = unmapped_buf; LIST_INIT(&bp->b_dep); - BUF_LOCKINIT(bp); + BUF_LOCKINIT(bp, buf_wmesg); bq_insert(&bqempty, bp, false); } diff --git a/sys/sys/buf.h b/sys/sys/buf.h index b831003cf63d..8fb49fb1e7d1 100644 --- a/sys/sys/buf.h +++ b/sys/sys/buf.h @@ -292,16 +292,14 @@ struct buf { /* * Buffer locking */ -extern const char *buf_wmesg; /* Default buffer lock message */ -#define BUF_WMESG "bufwait" #include /* XXX for curthread */ #include /* * Initialize a lock. */ -#define BUF_LOCKINIT(bp) \ - lockinit(&(bp)->b_lock, PRIBIO + 4, buf_wmesg, 0, LK_NEW) +#define BUF_LOCKINIT(bp, wmesg) \ + lockinit(&(bp)->b_lock, PRIBIO + 4, wmesg, 0, LK_NEW) /* * * Get a lock sleeping non-interruptably until it becomes available. diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 6a186156b616..7dba1c45143d 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -489,6 +489,8 @@ pbuf_dtor(void *mem, int size, void *arg) BUF_UNLOCK(bp); } +static const char pbuf_wmesg[] = "pbufwait"; + static int pbuf_init(void *mem, int size, int flags) { @@ -498,7 +500,7 @@ pbuf_init(void *mem, int size, int flags) if (bp->b_kvabase == NULL) return (ENOMEM); bp->b_kvasize = ptoa(PBUF_PAGES); - BUF_LOCKINIT(bp); + BUF_LOCKINIT(bp, pbuf_wmesg); LIST_INIT(&bp->b_dep); bp->b_rcred = bp->b_wcred = NOCRED; bp->b_xflags = 0;