From nobody Sun Apr 07 17:29:20 2024 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 4VCK350KY7z5HCCQ; Sun, 7 Apr 2024 17:29:21 +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 4VCK346vvYz4QDD; Sun, 7 Apr 2024 17:29:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712510961; 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=A6aF0Ob5/Iodluq7Cc9PRIsFWt9o+C7H9JZk0Q1bKEU=; b=YTMrQA80Ik8eAwidOzXJ/BqV5PHd2Pfq0x8a6Pwy8WXPA4dK6wbgJD3lfPWoPcxRglilQm GWTWOlDe1L4a+LuhwylZtol9hyhzJpmKZExmMw1hSWP0/lGzNaoCCNkbQfFtkBiI+383da 9hiKUbFLxfHRfef4eB8UZpfvVEorOW35azifvLAxBG+LXC2kz66kUB3uvOGau0KCqayzU7 HFdjkwlpwFCOv2SAKpae/wbfJKIuGv5ikUXQSdkEJYpxJXHKfKf1uQWxi5WLpllF/8qt6m Ehf77u6LiaSPxLhnsbgkZebfXjth4Ztm6wVZX634lFwcOcVkvPwop7n9ILg4qA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1712510961; a=rsa-sha256; cv=none; b=wA+tE7Rjcb/lkSJ46LgaeBr7XRi2GiYAzT5W5X638EbGeCkSYVkD+622btu/tR49n5V9mH LBbub3ap8Vmd9yledgOS9J3Wuaj8p0j0L/cJdbrGhYLI4ZibVIMS0l+QNJoliko2HSngBU 6jZuvxe+y64CCQagG1fkivfBEmdCDP9TSk93S6QKXznl8r+D3nvJUW1+Pcw9rHEJfWC1u8 kwwKSrcWHkZTZS8rpebbWlllNFWUdQBBD0CuF8uTHogAFOT72xJsTdLTZVb4Zg4Ix3H7DM 47stooKRsgV+85HDY5g1iS9856DOMK8Q50MZ2czojGZcUg82K7+y45g+zYb27w== 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=1712510961; 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=A6aF0Ob5/Iodluq7Cc9PRIsFWt9o+C7H9JZk0Q1bKEU=; b=v5s2E3+9A3zGs3tRRE2j5Icx9ZAwFCf57jxUBBHmswlVXRwIQGJ3Iq3pTkWo6/RiTI/REc CrsL2K+hi/pw2pDYGBrFGyXnBCXoe+zr71bN0LfVnLxXReIcv9iAkhE24rpIsvHh40qvk2 4GSkhIaEgukj23a0rwOi5pvGHH6sQ7xFCQJN1DKEpu+E48zTHe4mRzIaKYRMJtgiLhTMoV A2fggW4XOOBoqWfia9BFmYT8n+qeIEsktxFueOGvV6mVDvZmMNDps0qTJ2PdjlOq6pqWbW s8ifiDgwJRx9lCswMyeiBYuX87g1Jtq1ICLTZ5yP7CGebBL5mLWKjmsKP9SLpA== 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 4VCK346WMKzcjJ; Sun, 7 Apr 2024 17:29:20 +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 437HTKxv077462; Sun, 7 Apr 2024 17:29:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 437HTKXB077459; Sun, 7 Apr 2024 17:29:20 GMT (envelope-from git) Date: Sun, 7 Apr 2024 17:29:20 GMT Message-Id: <202404071729.437HTKXB077459@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Doug Moore Subject: git: 1526667bc6e2 - main - vm_reserv: Add vm_reserv_is_populated 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: dougm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1526667bc6e2c1042010de25e7a0226c0f1b44be Auto-Submitted: auto-generated The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=1526667bc6e2c1042010de25e7a0226c0f1b44be commit 1526667bc6e2c1042010de25e7a0226c0f1b44be Author: Doug Moore AuthorDate: 2024-04-07 17:19:41 +0000 Commit: Doug Moore CommitDate: 2024-04-07 17:28:52 +0000 vm_reserv: Add vm_reserv_is_populated Add a function to check whether an aligned block of vm pages are allocated, for use with impending changes to arm64 superpage managment. Reviewed by: alc Differential Revision: http://reviews.freebsd.org/D44575 --- sys/vm/vm_reserv.c | 21 +++++++++++++++++++++ sys/vm/vm_reserv.h | 1 + 2 files changed, 22 insertions(+) diff --git a/sys/vm/vm_reserv.c b/sys/vm/vm_reserv.c index 7b4a39a34906..b3b1dc62f14e 100644 --- a/sys/vm/vm_reserv.c +++ b/sys/vm/vm_reserv.c @@ -1058,6 +1058,27 @@ vm_reserv_is_page_free(vm_page_t m) return (!bit_test(rv->popmap, m - rv->pages)); } +/* + * Returns true if the given page is part of a block of npages, starting at a + * multiple of npages, that are all allocated. Otherwise, returns false. + */ +bool +vm_reserv_is_populated(vm_page_t m, int npages) +{ + vm_reserv_t rv; + int index; + + KASSERT(npages <= VM_LEVEL_0_NPAGES, + ("%s: npages %d exceeds VM_LEVEL_0_NPAGES", __func__, npages)); + KASSERT(powerof2(npages), + ("%s: npages %d is not a power of 2", __func__, npages)); + rv = vm_reserv_from_page(m); + if (rv->object == NULL) + return (false); + index = rounddown2(m - rv->pages, npages); + return (bit_ntest(rv->popmap, index, index + npages - 1, 1)); +} + /* * If the given page belongs to a reservation, returns the level of that * reservation. Otherwise, returns -1. diff --git a/sys/vm/vm_reserv.h b/sys/vm/vm_reserv.h index 44e8a939d165..98780efc9d37 100644 --- a/sys/vm/vm_reserv.h +++ b/sys/vm/vm_reserv.h @@ -55,6 +55,7 @@ void vm_reserv_break_all(vm_object_t object); boolean_t vm_reserv_free_page(vm_page_t m); void vm_reserv_init(void); bool vm_reserv_is_page_free(vm_page_t m); +bool vm_reserv_is_populated(vm_page_t m, int npages); int vm_reserv_level(vm_page_t m); int vm_reserv_level_iffullpop(vm_page_t m); vm_page_t vm_reserv_reclaim_contig(int domain, u_long npages,