Date: Thu, 10 Oct 2024 16:08:48 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: c71c41da618a - main - vm_radix: add iter insert and remove interfaces Message-ID: <202410101608.49AG8m6Q064436@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=c71c41da618a468349e5b32b77d627718264f97e commit c71c41da618a468349e5b32b77d627718264f97e Author: Doug Moore <dougm@FreeBSD.org> AuthorDate: 2024-10-10 16:07:40 +0000 Commit: Doug Moore <dougm@FreeBSD.org> CommitDate: 2024-10-10 16:07:40 +0000 vm_radix: add iter insert and remove interfaces Add functions in the vm_radix style for using iterators to insert or remove a page from a radix tree. Reviewed by: alc Differential Revision: https://reviews.freebsd.org/D47021 --- sys/vm/vm_radix.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/sys/vm/vm_radix.h b/sys/vm/vm_radix.h index d35c9a171d4b..e1f7323dd205 100644 --- a/sys/vm/vm_radix.h +++ b/sys/vm/vm_radix.h @@ -60,7 +60,7 @@ PCTRIE_DEFINE_SMR(VM_RADIX, vm_page, pindex, vm_radix_node_alloc, vm_radix_node_free, vm_radix_smr); /* - * Inserts the key-value pair into the trie. + * Inserts the key-value pair into the trie, starting search from root. * Panics if the key already exists. */ static __inline int @@ -69,6 +69,16 @@ vm_radix_insert(struct vm_radix *rtree, vm_page_t page) return (VM_RADIX_PCTRIE_INSERT(&rtree->rt_trie, page)); } +/* + * Inserts the key-value pair into the trie, starting search from iterator. + * Panics if the key already exists. + */ +static __inline int +vm_radix_iter_insert(struct pctrie_iter *pages, vm_page_t page) +{ + return (VM_RADIX_PCTRIE_ITER_INSERT(pages, page)); +} + /* * Insert the page into the vm_radix tree with its pindex as the key. Panic if * the pindex already exists. Return zero on success or a non-zero error on @@ -187,6 +197,15 @@ vm_radix_remove(struct vm_radix *rtree, vm_pindex_t index) { return (VM_RADIX_PCTRIE_REMOVE_LOOKUP(&rtree->rt_trie, index)); } + +/* + * Remove the current page from the trie. + */ +static __inline void +vm_radix_iter_remove(struct pctrie_iter *pages) +{ + VM_RADIX_PCTRIE_ITER_REMOVE(pages); +} /* * Reclaim all the interior nodes of the trie, and invoke the callback
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202410101608.49AG8m6Q064436>