mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
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
This commit is contained in:
parent
6b9acd1bfb
commit
889a9acc54
1 changed files with 4 additions and 1 deletions
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Reference in a new issue