From nobody Tue Dec 28 02:01:12 2021 X-Original-To: dev-commits-src-all@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 AB78D19003B5; Tue, 28 Dec 2021 02:01:12 +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 4JNHnh3BVVz3my6; Tue, 28 Dec 2021 02:01:12 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4D412EA9; Tue, 28 Dec 2021 02:01:12 +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 1BS21CrN084841; Tue, 28 Dec 2021 02:01:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BS21Crv084840; Tue, 28 Dec 2021 02:01:12 GMT (envelope-from git) Date: Tue, 28 Dec 2021 02:01:12 GMT Message-Id: <202112280201.1BS21Crv084840@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: f4bf48c25c3a - main - GEOM: Minor polishing in geom_event. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f4bf48c25c3a8de3fbfd49b45b2d59026df13a6a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640656872; 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=Rky3HwkwERRxtrp7gjjJc7ZqGaZhN8PF5RRDvFo0tIY=; b=P2JdZlTO6TsGMccrcEZ8siz/6jA76dm3lG+HkMMlEHE1rJqV5u1ygb5TW07/sLcjaGiozc PJR+oTMdb9oSQ9K7jwt4SwXeGzTxSNd5lf/D5ME1KG29bmsPLbNBcavULIf7sC2OYlZOf8 OOp/XNaV/zP1UdJDK6YAx2HigKtveDnvKi9K51jpEpPGQwIPXsVPxTUrbHeqVKpkNj4lrl /gJxeGy54q53eGwcHbAoWbftJkPqsZ0kx3/6aB9D+Q9Mox1rQwTT6RHTmvZV0XWaf6WmMd mESkjAtqDwRyPYRN2cJ1YCbWzTRZ/PriqugsLgL+Ne2Na2d6gxifGg3opWv8gQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640656872; a=rsa-sha256; cv=none; b=EepbbBCaJVozIzW0b0iucPwUJDRMTeRl/72xNjvlP3tBsk1mQcl1szfbA0q4X3FW58oACH JdujtkFgOM66mP1IxzL+X+Q35ekOxLIPw8gB4QM8/WtTzhBZKy0l0wAE3IXYi/hidvYgwG WSK5+PuyFh+Qr3RTbdpEgMFK9wxKNzY/Qz8Ha0q5djrvWOVejMHfP3GY9b69sN77Pa7qjZ fKOT5VPQ3+RFPrihhx2KfaGUOi6sSGLUZc91YSAlfiJXM8P3HcMBj7bpXUh81sJnXvm0ka QG2iVtVRDLn3TCm1S7apdtRxXkg83TpTsVOV+atyPxKBUC5NICzyiCDbIT+3Eg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=f4bf48c25c3a8de3fbfd49b45b2d59026df13a6a commit f4bf48c25c3a8de3fbfd49b45b2d59026df13a6a Author: Alexander Motin AuthorDate: 2021-12-28 01:52:59 +0000 Commit: Alexander Motin CommitDate: 2021-12-28 02:01:08 +0000 GEOM: Minor polishing in geom_event. - Remove timeouts from msleep()'s. Those should always be woken up. - Move wakeup() under the lock to not call on possibly freed pointer. - Remove some dead code. MFC after: 2 weeks --- sys/geom/geom.h | 1 - sys/geom/geom_event.c | 27 +++------------------------ 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/sys/geom/geom.h b/sys/geom/geom.h index 0d6d74d0b51c..d48deb0e0ae4 100644 --- a/sys/geom/geom.h +++ b/sys/geom/geom.h @@ -268,7 +268,6 @@ int g_attr_changed(struct g_provider *pp, const char *attr, int flag); int g_media_changed(struct g_provider *pp, int flag); int g_media_gone(struct g_provider *pp, int flag); void g_orphan_provider(struct g_provider *pp, int error); -void g_waitidlelock(void); struct g_event *g_alloc_event(int flag); void g_post_event_ep(g_event_t *func, void *arg, struct g_event *ep, ...); diff --git a/sys/geom/geom_event.c b/sys/geom/geom_event.c index f9a1d445d36a..359c7c984f07 100644 --- a/sys/geom/geom_event.c +++ b/sys/geom/geom_event.c @@ -90,29 +90,12 @@ g_waitidle(void) TSWAIT("GEOM events"); while (!TAILQ_EMPTY(&g_events)) msleep(&g_pending_events, &g_eventlock, PPAUSE, - "g_waitidle", hz/5); + "g_waitidle", 0); TSUNWAIT("GEOM events"); mtx_unlock(&g_eventlock); curthread->td_pflags &= ~TDP_GEOM; } -#if 0 -void -g_waitidlelock(void) -{ - - g_topology_assert(); - mtx_lock(&g_eventlock); - while (!TAILQ_EMPTY(&g_events)) { - g_topology_unlock(); - msleep(&g_pending_events, &g_eventlock, PPAUSE, - "g_waitidlel", hz/5); - g_topology_lock(); - } - mtx_unlock(&g_eventlock); -} -#endif - struct g_attrchanged_args { struct g_provider *pp; const char *attr; @@ -254,10 +237,6 @@ one_event(void) wakeup(&g_pending_events); return (0); } - if (ep->flag & EV_INPROGRESS) { - mtx_unlock(&g_eventlock); - return (1); - } ep->flag |= EV_INPROGRESS; mtx_unlock(&g_eventlock); g_topology_assert(); @@ -269,8 +248,8 @@ one_event(void) ep->flag &= ~EV_INPROGRESS; if (ep->flag & EV_WAKEUP) { ep->flag |= EV_DONE; - mtx_unlock(&g_eventlock); wakeup(ep); + mtx_unlock(&g_eventlock); } else { mtx_unlock(&g_eventlock); g_free(ep); @@ -457,7 +436,7 @@ g_waitfor_event(g_event_t *func, void *arg, int flag, ...) mtx_lock(&g_eventlock); while (!(ep->flag & EV_DONE)) - msleep(ep, &g_eventlock, PRIBIO, "g_waitfor_event", hz); + msleep(ep, &g_eventlock, PRIBIO, "g_waitfor_event", 0); if (ep->flag & EV_CANCELED) error = EAGAIN; mtx_unlock(&g_eventlock);