From nobody Thu Feb 16 07:33:58 2023 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 4PHRX62Z8hz3pJ6B; Thu, 16 Feb 2023 07:33:58 +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 4PHRX61vbcz3Gyq; Thu, 16 Feb 2023 07:33:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676532838; 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=Lwgg6vJJMuJg43LWSg/aQjcXmDetQO9ScrojyUUCE6U=; b=QTwXrtXzq+g0TgXzZPGPKMmCw1CWALRov2mFpNqFMWhMSX9AHd0ZRf4qk2cKbQ74pFqSH9 I6pJNnpyS8SQ3rY/T0ZkvfFlJKIOai4Q1oV3MYniu1LoEwrzlalM5qQ0RzdiJgmNbc+kdx tfC6V2XsoFHbE9JTb8GNDCrvKDu8pMKflBqY2zoDAOTYX3hXVN0gyUKt8J0bQyOPa9Khlq yGVg5kykInB9movM9k5l2bKch4ZFW/+L/ljr4K8UpY26iq9TUwhdWxurqC3R6n9YbzhqG/ aY/ZfaRJXA2sPEgUR5B0Aop8wsl9rALwJrBXGWwgrMdeDgMXOl4Ya1Aoi/NjRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676532838; 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=Lwgg6vJJMuJg43LWSg/aQjcXmDetQO9ScrojyUUCE6U=; b=FyN1VIvhcLyVLy96XWUOCNVVMDH+2iY0EHokQNVX4aGra5Rk92D751K+6Z0j0jCALKKjp/ HzXYhnjw86ra3/tex/elAOa85A9ZBaTUhmMf9ZV1Dzf/XdsqEh4fFd3/ekSXXNewC7BeBd VjlczCp08qavasaxhhluRFr0ledAlafzmfc7y6AqeJxF//JcLXz7Fsq+qBBelrtJ4LBl8t xyfackXarxd16oqrnxN8CyD0MGy6dkjmj8nmqck1AfJHmh+lFK1hAoGKDRqbWx96Huo3OQ fQdfWp6VchN+h822rQk5lZ0e2UMh2C4qQjeKrcM6tBJRqB89M3s8PXD7f0gdWA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676532838; a=rsa-sha256; cv=none; b=muEaNMjpoDsMASpYlO488fO/1w3bPdFgT3LtnRHAK9jS5kGHClilRIqNO0EHGzQA82ddtM 0MMuRgqK9ehrtTkrZnCuldpfDsu7Is9HbDBKrOKAXyEPpTj4Eg2nhf3evUm2Jkwre0LxoH trYiNEGJFYONztStYe2mpWEp0oPLLKpE+7Nbu/7Fu8j+QgkQ7XQbqkdDdx/8gRkVyo+tqs hPYWC8E1+6uDifF59zkBvnW+M8n31gvSInSHG7mS9BGHH5tzdbppViokl9PeebvMTmrWmy uRXsqtwO7zeCQAOwq+jVdn5SOwXrLv+xql4BEVsd8uNRIRwSQyfGgzYEqo9lyQ== 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 4PHRX60zhDzwPr; Thu, 16 Feb 2023 07:33:58 +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 31G7Xwca084575; Thu, 16 Feb 2023 07:33:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31G7Xww1084574; Thu, 16 Feb 2023 07:33:58 GMT (envelope-from git) Date: Thu, 16 Feb 2023 07:33:58 GMT Message-Id: <202302160733.31G7Xww1084574@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 889a9acc5475 - main - ipsec: only update lastused when it changes 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: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 889a9acc54758922b3529ea473a2dac159d85fd5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=889a9acc54758922b3529ea473a2dac159d85fd5 commit 889a9acc54758922b3529ea473a2dac159d85fd5 Author: Mateusz Guzik AuthorDate: 2023-02-08 09:53:05 +0000 Commit: Mateusz Guzik CommitDate: 2023-02-16 07:33:51 +0000 ipsec: only update lastused when it changes to limit cache-line bouncing. Note that as there is no atomic_store we are hoping the compiler wont speculatively do the store. It is not employed because the size depends on target arch. Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D38433 --- sys/netipsec/key.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c index 345c302c2a80..62aa99019437 100644 --- a/sys/netipsec/key.c +++ b/sys/netipsec/key.c @@ -917,6 +917,7 @@ key_allocsp(struct secpolicyindex *spidx, u_int dir) struct spdcache_entry *entry, *lastentry, *tmpentry; struct secpolicy *sp; uint32_t hashv; + time_t ts; int nb_entries; if (!SPDCACHE_ACTIVE()) { @@ -969,7 +970,9 @@ key_allocsp(struct secpolicyindex *spidx, u_int dir) out: if (sp != NULL) { /* found a SPD entry */ - sp->lastused = time_second; + ts = time_second; + if (__predict_false(sp->lastused != ts)) + sp->lastused = ts; KEYDBG(IPSEC_STAMP, printf("%s: return SP(%p)\n", __func__, sp)); KEYDBG(IPSEC_DATA, kdebug_secpolicy(sp));