From nobody Sat Sep 02 10:24:10 2023 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 4Rd9x64hdhz4rWkS; Sat, 2 Sep 2023 10:24:10 +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 4Rd9x64Gq9z4Mlk; Sat, 2 Sep 2023 10:24:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1693650250; 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=HsAvS0gVgSncw02o0FuLWQQL5RbkpiCj3y2+fL7dk80=; b=kogcrunDogLbjoM5JIRLeT0JNXVpFkJTDD9hney50EZfm1HAwtQmmuAhc+U1QCxiLK+tjs o/joRWo1aJ6zheVwn8dTl8QniLc4trpOefk1gL4NVklQpj+h/JhjvPs/qb0l41yiRcFA3B Nfr0qxinBplk1X6HH9Y0QG2zxbNKOUPm26gGIJKJLxc42tElsx57oGPJ0N6rkyJYCrfy+F aV3FQxXaHDjTxZjKYd4hw+eMtyWy5654ptablYYxKv8iddp7FfIdro0TwytpzMDFVBXbkd P5vLVaWsFi7N70TRzhO4soHUs5xw/+0shqHZHCb+HCgpF7E5aaQe+j2aENdjSA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1693650250; a=rsa-sha256; cv=none; b=d8S6Xu2XQqRoD10KKyNOCb8kVOe3Vli0yM8gb25CJph0y9tniOm0W31pfaK2/LONyuNZpL yNWpgJId61VTAtly0i7uzM+haAYop2jJOzBxKZYX5ezNvHpU3WgSFBm5YwdUwPkxrt8uUZ aWR9pwsASFtUKOJkTFRafgeK1I7nHR5wn+e1WC3m3MzPY5iTgqVR+NikSYRvw0OsxMwSR6 RxP6oamLjlwEn/QMxceiMLdfFJnYT5THUiDVXYd7+8PMcS2bNSY5iWtMeZVR/+5xzw52Ca lHxbQagWtJfKTwcw3/cKybYL86e4FCo9Z98wprY2C9Ddwh2oRL2tdtzSz3tlEw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1693650250; 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=HsAvS0gVgSncw02o0FuLWQQL5RbkpiCj3y2+fL7dk80=; b=hDNPKTnMJiqjB9A6RGjPwuMub2afiHP3MuVRIq5LKDqq653KjXtTMxWrMdl360KQbMyFuH LcF52vkabUPJvhF2UtzcBrVE52kt94HK74HGuRqTLbbyf5JIV0T2m22c1iQ5F1j1feFDao XAnxLC8j4JNiKle6DrofqDFaZArNKlXjAyW5owJuKkdjSFbxbmAU2YN1oS2uizNQeNVh96 9A4W66tazjZ2EZxJl1O/cjgcVSuAzuaRThw1AlapaXYuNjHIlaLScbVojyYN3A/2yw0fgO Bqq5QdyQUcm0sv/B0dlAGsrnXWwoDm9MXNHcPpLopqwCdof+cdy4BMCffQPXow== 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 4Rd9x63M38zfvX; Sat, 2 Sep 2023 10:24:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 382AOAXm014078; Sat, 2 Sep 2023 10:24:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 382AOAYs014075; Sat, 2 Sep 2023 10:24:10 GMT (envelope-from git) Date: Sat, 2 Sep 2023 10:24:10 GMT Message-Id: <202309021024.382AOAYs014075@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: f4296cfb409a - main - timerfd: convert timerfd_list_lock from sx to mtx 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: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f4296cfb409a48de00bfa60e76f686c2b031876f Auto-Submitted: auto-generated The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=f4296cfb409a48de00bfa60e76f686c2b031876f commit f4296cfb409a48de00bfa60e76f686c2b031876f Author: Mateusz Guzik AuthorDate: 2023-09-02 09:55:50 +0000 Commit: Mateusz Guzik CommitDate: 2023-09-02 09:55:50 +0000 timerfd: convert timerfd_list_lock from sx to mtx There was no good reason to use the former. This should prevent some head-scratching by an interested and qualified reader. --- sys/kern/sys_timerfd.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/kern/sys_timerfd.c b/sys/kern/sys_timerfd.c index c8b45a926b02..e4d2f10f28ef 100644 --- a/sys/kern/sys_timerfd.c +++ b/sys/kern/sys_timerfd.c @@ -61,9 +61,9 @@ static MALLOC_DEFINE(M_TIMERFD, "timerfd", "timerfd structures"); -static struct sx timerfd_list_lock; +static struct mtx timerfd_list_lock; static LIST_HEAD(, timerfd) timerfd_list; -SX_SYSINIT(timerfd, &timerfd_list_lock, "timerfd_list_lock"); +MTX_SYSINIT(timerfd, &timerfd_list_lock, "timerfd_list_lock", MTX_DEF); static struct unrhdr64 tfdino_unr; @@ -133,7 +133,7 @@ timerfd_jumped(void) return; timerfd_getboottime(&boottime); - sx_xlock(&timerfd_list_lock); + mtx_lock(&timerfd_list_lock); LIST_FOREACH(tfd, &timerfd_list, entry) { mtx_lock(&tfd->tfd_lock); if (tfd->tfd_clockid != CLOCK_REALTIME || @@ -169,7 +169,7 @@ timerfd_jumped(void) tfd->tfd_boottim = boottime; mtx_unlock(&tfd->tfd_lock); } - sx_xunlock(&timerfd_list_lock); + mtx_unlock(&timerfd_list_lock); } static int @@ -324,9 +324,9 @@ timerfd_close(struct file *fp, struct thread *td) { struct timerfd *tfd = fp->f_data; - sx_xlock(&timerfd_list_lock); + mtx_lock(&timerfd_list_lock); LIST_REMOVE(tfd, entry); - sx_xunlock(&timerfd_list_lock); + mtx_unlock(&timerfd_list_lock); callout_drain(&tfd->tfd_callout); seldrain(&tfd->tfd_sel); @@ -450,9 +450,9 @@ kern_timerfd_create(struct thread *td, int clockid, int flags) knlist_init_mtx(&tfd->tfd_sel.si_note, &tfd->tfd_lock); timerfd_getboottime(&tfd->tfd_boottim); getnanotime(&tfd->tfd_birthtim); - sx_xlock(&timerfd_list_lock); + mtx_lock(&timerfd_list_lock); LIST_INSERT_HEAD(&timerfd_list, tfd, entry); - sx_xunlock(&timerfd_list_lock); + mtx_unlock(&timerfd_list_lock); finit(fp, fflags, DTYPE_TIMERFD, tfd, &timerfdops);