From nobody Tue Jan 14 17:55:13 2025 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 4YXcGn5tb1z5kD0p; Tue, 14 Jan 2025 17:55:13 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXcGn5Kwfz44cx; Tue, 14 Jan 2025 17:55:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736877313; 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=jdrIVILWEfg4MH7TaFDr4FeWt0Sp3fcxG9elz7SUGVU=; b=UtFxOyJs5kyvmlpzApZvcR7e5PiuYcHPGWxzRIKADOtr24xXmZP+VlS41RFSzFBErgl7nT JfvLmSJ+zLnLkxh2A2Z5+3X/EYfIrR8lVP6+HJubzy/wVC/jg2g/Jgi2d0yl9a//KBIc0y 3kNCqXEmVQOdKEFdss59+gBvrdn/66Mg7l8IF4TuFcdWeRlqmE6JFHVzUNG0/stO0bCf/U NqmN7qHPpJCiUO3NfKdw7bYxA9RjPeqbugrWv0v5y/x8qZ+A/p5DG918pj1PH8TtHWuxNm mt1hjbmfGaFGAi6ukfly/wz8Me9uwzyEOfhgOD1ZIPxy4troplb2KfHJztAq3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736877313; 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=jdrIVILWEfg4MH7TaFDr4FeWt0Sp3fcxG9elz7SUGVU=; b=fUYOLB2h5JmhuDjLh1V9BUmt2hZlj8+CRV/voqHyBpi/4NZuU/OvTly2B0PHGYcPbe/c2U e6tNGQWYI9YusNipLE1ZTD6tHb/ZRBOCKzW3nO+58ygiD9K0fls25lyEr0Mg1obAnU2FOm mg7B/aZlljgIzAKLP8yh0HW4GXi0mUvfjJSHIWhhOa1hD1qrRT2Wy43wiTEacRtrnPkSfF HhytdF5BO3evrwxeATqChoSyYumqMpwS6DXSOqjjrLsDqGOnSFQ7BCrpDvPXOPiTzsVkUf O88vEYLM+AZ9QMEOGspZkMRAMpKXYPxmS4wWIWybmEoxkWSivoEi23CAHGTtdA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736877313; a=rsa-sha256; cv=none; b=qUsJ4HfhxkAFLAK0icjNPsrnaCmXRvPX1sfY6l7X238njnnWacuqQPCM8009KBzwOCIOfb H+3B+fNCTlo8DzP5bAPQjwsy8ITPiXPxuEzxDpypb4D0i1hHqaaBOyxN0I+BJsdTlH/TCV +ykFIuaGIBUQVgKgrCq8LG4FlEtx9T+MLaKeowdQ5DSdAo9qw8OELOa67YKfNh/w3IW3i5 +4A5ua18tGp06Qaa9NKtH42v37rJ8DBI2Gx6HuHPEJZvvyGT2zZ7qaNG/zAzxQxSnhF+In 0DAnNOOtJaecdT7w2Mh1+HFkNSrIX+qTZN/qo9OxF+ld1yX04CfxvuY25H7NzA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YXcGn4kQbz1QSV; Tue, 14 Jan 2025 17:55:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50EHtDV7072545; Tue, 14 Jan 2025 17:55:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50EHtD0T072542; Tue, 14 Jan 2025 17:55:13 GMT (envelope-from git) Date: Tue, 14 Jan 2025 17:55:13 GMT Message-Id: <202501141755.50EHtD0T072542@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: 4804cb433dbe - main - libthr: use atomic_add_int() instead of atomic_fetchadd_int() 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-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: 4804cb433dbec2555695dc2bf391f286f2172621 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4804cb433dbec2555695dc2bf391f286f2172621 commit 4804cb433dbec2555695dc2bf391f286f2172621 Author: Konstantin Belousov AuthorDate: 2025-01-13 19:18:40 +0000 Commit: Konstantin Belousov CommitDate: 2025-01-14 17:55:07 +0000 libthr: use atomic_add_int() instead of atomic_fetchadd_int() the return value is ignored. Reviewed by: markj, olce Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D48454 --- lib/libthr/thread/thr_list.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/libthr/thread/thr_list.c b/lib/libthr/thread/thr_list.c index 7da851dff681..bca2bfc75fef 100644 --- a/lib/libthr/thread/thr_list.c +++ b/lib/libthr/thread/thr_list.c @@ -149,16 +149,16 @@ _thr_alloc(struct pthread *curthread) if (thread == NULL) { if (total_threads > MAX_THREADS) return (NULL); - atomic_fetchadd_int(&total_threads, 1); + atomic_add_int(&total_threads, 1); thread = calloc(1, sizeof(struct pthread)); if (thread == NULL) { - atomic_fetchadd_int(&total_threads, -1); + atomic_add_int(&total_threads, -1); return (NULL); } if ((thread->sleepqueue = _sleepq_alloc()) == NULL || (thread->wake_addr = _thr_alloc_wake_addr()) == NULL) { thr_destroy(curthread, thread); - atomic_fetchadd_int(&total_threads, -1); + atomic_add_int(&total_threads, -1); return (NULL); } } else { @@ -176,7 +176,7 @@ _thr_alloc(struct pthread *curthread) thread->tcb = tcb; } else { thr_destroy(curthread, thread); - atomic_fetchadd_int(&total_threads, -1); + atomic_add_int(&total_threads, -1); thread = NULL; } return (thread); @@ -202,7 +202,7 @@ _thr_free(struct pthread *curthread, struct pthread *thread) thread->tcb = NULL; if ((curthread == NULL) || (free_thread_count >= MAX_CACHED_THREADS)) { thr_destroy(curthread, thread); - atomic_fetchadd_int(&total_threads, -1); + atomic_add_int(&total_threads, -1); } else { /* * Add the thread to the free thread list, this also avoids