PSA id d75a77b69052e-4ab6de94c3esm22041021cf.36.2025.07.15.10.24.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jul 2025 10:24:39 -0700 (PDT) Date: Tue, 15 Jul 2025 13:24:36 -0400 From: Mark Johnston To: Gleb Smirnoff Cc: alc@freebsd.org, kib@freebsd.org, src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: fad79db40505 - main - vm_pageout: Remove a volatile qualifier from some vm_domain members Message-ID: References: <202507151519.56FFJ4FS013944@gitrepo.freebsd.org> 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4bhQzZ4dgpz3RFF X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] On Tue, Jul 15, 2025 at 09:40:18AM -0700, Gleb Smirnoff wrote: > On Tue, Jul 15, 2025 at 03:19:04PM +0000, Mark Johnston wrote: > M> The branch main has been updated by markj: > M> > M> URL: https://cgit.FreeBSD.org/src/commit/?id=fad79db405052f3faad7184ea2c8bfe9f92a700d > M> > M> commit fad79db405052f3faad7184ea2c8bfe9f92a700d > M> Author: Mark Johnston > M> AuthorDate: 2025-07-15 15:16:40 +0000 > M> Commit: Mark Johnston > M> CommitDate: 2025-07-15 15:16:40 +0000 > M> > M> vm_pageout: Remove a volatile qualifier from some vm_domain members > M> > M> These are always accessed using atomic(9) intrinsics, so do not need the > M> qualifier. No functional change intended. > M> > M> Reviewed by: alc, kib > M> MFC after: 2 weeks > M> Sponsored by: Modirum MDPay > M> Sponsored by: Klara, Inc. > M> Differential Revision: https://reviews.freebsd.org/D51322 > > What's the benefit of removing the qualifiers? They act as documentation > and they match atomic(9) prototypes. To me this looks like removing a > const qualifier with a reasoning that we use the variable only as an > argument to functions that have const qualifier. Note that I updated the comments as well to indicate that accesses to the fields should be done through atomic(9), so the documentation is preserved. The reason atomic(9) prototypes include the volatile qualifier is to permit their use with volatile-qualified variables without a cast, not because the interface expects only volatile-qualified parameters. More generally, I believe that new code should always avoid using volatile to provide any kind of synchronization, ignoring the case of accesses to memory mapped with non-default attributes. atomic(9) intrinsics should be used where they are needed, and some comments should explain the synchronization protocol if it's not obvious.