Date: Sun, 6 Oct 2024 20:11:31 GMT From: Doug Moore <dougm@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 9147a0c93bc0 - main - pctrie: don't assign to root Message-ID: <202410062011.496KBVFq068881@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=9147a0c93bc0b93d2d9d11e0a5a4a7358d04137a commit 9147a0c93bc0b93d2d9d11e0a5a4a7358d04137a Author: Doug Moore <dougm@FreeBSD.org> AuthorDate: 2024-10-06 20:10:10 +0000 Commit: Doug Moore <dougm@FreeBSD.org> CommitDate: 2024-10-06 20:10:10 +0000 pctrie: don't assign to root User pctrie_root_store(*, PCTRIE_LOCKED) to change the root value of a pctrie, to ensure proper synchronization when smr is in use. Reviewed by: alc Differential Revision: https://reviews.freebsd.org/D46968 --- sys/kern/subr_pctrie.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/kern/subr_pctrie.c b/sys/kern/subr_pctrie.c index b461ffa3c5be..a7b487166054 100644 --- a/sys/kern/subr_pctrie.c +++ b/sys/kern/subr_pctrie.c @@ -304,7 +304,8 @@ pctrie_insert_lookup_compound(struct pctrie *ptree, uint64_t *val, if (pctrie_isleaf(node)) { if (node == PCTRIE_NULL) { if (parent == NULL) - ptree->pt_root = pctrie_toleaf(val); + pctrie_root_store(ptree, + pctrie_toleaf(val), PCTRIE_LOCKED); else pctrie_addnode(parent, index, pctrie_toleaf(val), PCTRIE_LOCKED); @@ -1242,7 +1243,8 @@ pctrie_replace(struct pctrie *ptree, uint64_t *newval) if (pctrie_isleaf(node)) { if ((m = pctrie_toval(node)) != NULL && *m == index) { if (parent == NULL) - ptree->pt_root = leaf; + pctrie_root_store(ptree, + leaf, PCTRIE_LOCKED); else pctrie_node_store( &parent->pn_child[slot], leaf,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202410062011.496KBVFq068881>