From nobody Tue Oct 15 13:36:07 2024 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 4XSZqq2M0Bz5Yxjp; Tue, 15 Oct 2024 13:36:07 +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 4XSZqq1nZzz4s1n; Tue, 15 Oct 2024 13:36:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728999367; 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=LupGm9GgiWlQL2Vs3Wiyna3GKY81SmV92EX1dJwFm+E=; b=bfLjIyIehuHSWPlRBTnfv6HF6IZBBdcrxtoe9cFutvhaohnkDPOgAgelXasavs36vJba0f kjsTF3LWzC9+uRJm0Aivs4xQbvZBSmxnVk/CclovwTVj8wHjd5buByV8uXye4WmB2OcpWO DJ0RT0SHmG8D4N5nSCGKMxjfJTvcvjV4tzCGdm67YLIzLyEx/DKxC84NH7JC/Us696C7Fp cxb92zmCrtYZedmuSAmyyDgygv5I2kY148mpE9wz2OUFVMtjxXrmkzne2DToMD/ZzEYxZQ Pyf2XbvCGTE+E5OYQxvhCYs6eibpaacNKPDIgHXQPl556f38Z+bGy+cKiJz1aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728999367; 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=LupGm9GgiWlQL2Vs3Wiyna3GKY81SmV92EX1dJwFm+E=; b=atA8NFWSvnEDk2jh5WjWr8gs7nD0zWLCRy4t/sNsz67WKXA+5BIr/NcxjS1EWrXfw9JfIz qUIWMBEaWWn2y3NaJmoeFFxoAozh3u7+FZCtOdl3hEvq0mhA1S9kbA1BY1srKGG37kIDUv zbUkQLRmc66BpdqqtEliM5aQWN/pV+oJP45qXnCejrpMkAMKYOuHO3LQNTrwkGb9RC3Bpj FNQmtVGq0ne0X/1XWGM1HibQe0rHAwIIxHeZfRLvi8sDPL6AESWLXxGcVN1DGDbfrdX1GB WtweX5Ve6o+KPobuZIUfblUN4rGAkUG9R/O/B9Hm3EMKchDqOyZPflfLhS4HxA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728999367; a=rsa-sha256; cv=none; b=KwiDoPdgsPt/HVWAJ8zdaMTcQ82fTAyWV6rve8PddJpT0aYp4brGzRpxZ3VA3JL4LdJUHb mlFFhl3Qac8gEMawEaG1gYqHawpwG6DcqsFqlQ8jn0XoK/mJ6WqmWdmliaETg+n7eTaEcP 0uhsuyvY+g++fM+AAEv1igFibQ2r8AiX/WSh/LtQGMu//FJu8R2dBMLyVK/4slInIB9UbV JhcTREm7mCkBJg3q/sKqalQbIHs7o+CMOjhhq8EQonUdirHAJX3JtsWLciU3lS/6g0sD+O z5ui49EWJtItTjeiOrPLDYMr5C8sqC3ZVk68F2U9j9N7UtqL+nIg8BYEJtEwdg== 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 4XSZqq1N5dzPRK; Tue, 15 Oct 2024 13:36:07 +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 49FDa7Bw035217; Tue, 15 Oct 2024 13:36:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49FDa70n035214; Tue, 15 Oct 2024 13:36:07 GMT (envelope-from git) Date: Tue, 15 Oct 2024 13:36:07 GMT Message-Id: <202410151336.49FDa70n035214@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 94e5ec7f869e - stable/14 - vm_page: Use atomic loads for cmpset loops 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 94e5ec7f869e244afa174af2f8a61e4355a2cb73 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=94e5ec7f869e244afa174af2f8a61e4355a2cb73 commit 94e5ec7f869e244afa174af2f8a61e4355a2cb73 Author: Mark Johnston AuthorDate: 2024-10-07 20:50:36 +0000 Commit: Mark Johnston CommitDate: 2024-10-15 12:39:44 +0000 vm_page: Use atomic loads for cmpset loops Make sure that the compiler loads the initial value value only once. Because atomic_fcmpset is used to load the value for subsequent iterations, this is probably not needed, but we should not rely on that. I verified that code generated for an amd64 GENERIC kernel does not change. Reviewed by: dougm, alc, kib Tested by: pho MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D46943 (cherry picked from commit d8b32da2354d2fd72ae017fd63affa3684786e1f) --- sys/vm/vm_page.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index fe104e1e87af..7c3083de42de 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -1972,7 +1972,7 @@ _vm_domain_allocate(struct vm_domain *vmd, int req_class, int npages) * Attempt to reserve the pages. Fail if we're below the limit. */ limit += npages; - old = vmd->vmd_free_count; + old = atomic_load_int(&vmd->vmd_free_count); do { if (old < limit) return (0); @@ -4054,7 +4054,7 @@ vm_page_wire_mapped(vm_page_t m) { u_int old; - old = m->ref_count; + old = atomic_load_int(&m->ref_count); do { KASSERT(old > 0, ("vm_page_wire_mapped: wiring unreferenced page %p", m)); @@ -4088,7 +4088,7 @@ vm_page_unwire_managed(vm_page_t m, uint8_t nqueue, bool noreuse) * Use a release store when updating the reference count to * synchronize with vm_page_free_prep(). */ - old = m->ref_count; + old = atomic_load_int(&m->ref_count); do { KASSERT(VPRC_WIRE_COUNT(old) > 0, ("vm_page_unwire: wire count underflow for page %p", m)); @@ -4383,7 +4383,7 @@ vm_page_try_blocked_op(vm_page_t m, void (*op)(vm_page_t)) ("vm_page_try_blocked_op: page %p is not busy", m)); VM_OBJECT_ASSERT_LOCKED(m->object); - old = m->ref_count; + old = atomic_load_int(&m->ref_count); do { KASSERT(old != 0, ("vm_page_try_blocked_op: page %p has no references", m));