From nobody Wed Dec 29 00:02:29 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 329C119012B9; Wed, 29 Dec 2021 00:02:30 +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 4JNs6F6nqkz4mpw; Wed, 29 Dec 2021 00:02:29 +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 C05381AFD6; Wed, 29 Dec 2021 00:02:29 +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 1BT02Te0047296; Wed, 29 Dec 2021 00:02:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BT02Tvj047295; Wed, 29 Dec 2021 00:02:29 GMT (envelope-from git) Date: Wed, 29 Dec 2021 00:02:29 GMT Message-Id: <202112290002.1BT02Tvj047295@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: 24b82aa0c543 - main - arm64: Simplify pmap_ts_referenced 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: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 24b82aa0c543cc6d63bfbde651b2325ae360dc50 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640736150; 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=L4HuwGNjyjvpwN8sDz/72W2lQVQibe/6+6oNXzbybDs=; b=YomDtZB/C9m5W49yQnOr4TBPrzKhz0KI8fn4D3KBH4wGckPZzD8LycEGk0SwYHaUVyHOfU A8VhZ3rzkedYan8B6prJYc0UwGBH63E3NwuKk94eLFFFx53We7lXbtAt+Xw+r8xDwd39YF vQ+SWw/pkAIyEXtNbxkcxa9+e/BwjEhCwsO4xrS9raCIWGqSnb/FM3Vtkj8i5/+17hm5GA Hk1mYYea6kCmZv189Lx/gHsik9BpsNZOOSzSiBlSgh9obQuwRhAqgqoB+dBunfpenVSDiv aQheb93W1j5giuzwo0p5b47wMusEKWKeTDN4Uja7S1jOML/4jikK5k7n26b34Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640736150; a=rsa-sha256; cv=none; b=hBS61dZJqwUGLg69sxmJS0W2U6a/bFnjGl5o4EFqbp5uQwVAM8ky8IqXePFS08SCfASjRU 86SSUNlBbELriVp/TmhpP29izQg6A8sxMd0XJafnBbnmq/opJEXozX/GIbB3NPfE8dU6Ot pNi5wNxpIVGxntZc8TBfyadeKMSiRH9EgWT+8QruKyINOdF9rC56cNA7CjbpXn5s4Ap8/9 IKj9+08fgDmJb3GoIf+dFtwnNMd36ebug8AQn4//XkpPQJ2YUTMYOAp+BjXuiRKGVp8a+k 0J0nJw0Uoue9pt7cZWiTeIqUkxoOknQk6g6y5AswXJZTygWg9XQ9DvcYySsTZQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=24b82aa0c543cc6d63bfbde651b2325ae360dc50 commit 24b82aa0c543cc6d63bfbde651b2325ae360dc50 Author: Alan Cox AuthorDate: 2021-12-28 00:27:52 +0000 Commit: Alan Cox CommitDate: 2021-12-28 23:59:39 +0000 arm64: Simplify pmap_ts_referenced Use pmap_pte_exists() in place of multiple KASSERT()s. Eliminate an unnecessary NULL check. MFC after: 1 week --- sys/arm64/arm64/pmap.c | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index 15bb813f591d..68164708dce9 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -5389,11 +5389,10 @@ pmap_ts_referenced(vm_page_t m) pv_entry_t pv, pvf; pmap_t pmap; struct rwlock *lock; - pd_entry_t *pde, tpde __diagused; pt_entry_t *pte, tpte; vm_offset_t va; vm_paddr_t pa; - int cleared, lvl, md_gen, not_cleared, pvh_gen; + int cleared, md_gen, not_cleared, pvh_gen; struct spglist free; KASSERT((m->oflags & VPO_UNMANAGED) == 0, @@ -5424,14 +5423,7 @@ retry: } } va = pv->pv_va; - pde = pmap_pde(pmap, va, &lvl); - KASSERT(pde != NULL, ("pmap_ts_referenced: no l1 table found")); - KASSERT(lvl == 1, - ("pmap_ts_referenced: invalid pde level %d", lvl)); - tpde = pmap_load(pde); - KASSERT((tpde & ATTR_DESCR_MASK) == L1_TABLE, - ("pmap_ts_referenced: found an invalid l1 table")); - pte = pmap_l1_to_l2(pde, va); + pte = pmap_pte_exists(pmap, va, 2, __func__); tpte = pmap_load(pte); if (pmap_pte_dirty(pmap, tpte)) { /* @@ -5441,7 +5433,6 @@ retry: */ vm_page_dirty(m); } - if ((tpte & ATTR_AF) != 0) { /* * Since this reference bit is shared by 512 4KB pages, @@ -5472,7 +5463,7 @@ retry: } PMAP_UNLOCK(pmap); /* Rotate the PV list if it has more than one entry. */ - if (pv != NULL && TAILQ_NEXT(pv, pv_next) != NULL) { + if (TAILQ_NEXT(pv, pv_next) != NULL) { TAILQ_REMOVE(&pvh->pv_list, pv, pv_next); TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_next); pvh->pv_gen++; @@ -5499,14 +5490,7 @@ small_mappings: goto retry; } } - pde = pmap_pde(pmap, pv->pv_va, &lvl); - KASSERT(pde != NULL, ("pmap_ts_referenced: no l2 table found")); - KASSERT(lvl == 2, - ("pmap_ts_referenced: invalid pde level %d", lvl)); - tpde = pmap_load(pde); - KASSERT((tpde & ATTR_DESCR_MASK) == L2_TABLE, - ("pmap_ts_referenced: found an invalid l2 table")); - pte = pmap_l2_to_l3(pde, pv->pv_va); + pte = pmap_pte_exists(pmap, pv->pv_va, 3, __func__); tpte = pmap_load(pte); if (pmap_pte_dirty(pmap, tpte)) vm_page_dirty(m); @@ -5520,7 +5504,7 @@ small_mappings: } PMAP_UNLOCK(pmap); /* Rotate the PV list if it has more than one entry. */ - if (pv != NULL && TAILQ_NEXT(pv, pv_next) != NULL) { + if (TAILQ_NEXT(pv, pv_next) != NULL) { TAILQ_REMOVE(&m->md.pv_list, pv, pv_next); TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_next); m->md.pv_gen++;