#
da76d349 |
| 03-May-2024 |
Bojan Novković <bnovkov@FreeBSD.org> |
uma: Deduplicate uma_small_alloc
This commit refactors the UMA small alloc code and removes most UMA machine-dependent code. The existing machine-dependent uma_small_alloc code is almost identical a
uma: Deduplicate uma_small_alloc
This commit refactors the UMA small alloc code and removes most UMA machine-dependent code. The existing machine-dependent uma_small_alloc code is almost identical across all architectures, except for powerpc where using the direct map addresses involved extra steps in some cases.
The MI/MD split was replaced by a default uma_small_alloc implementation that can be overridden by architecture-specific code by defining the UMA_MD_SMALL_ALLOC symbol. Furthermore, UMA_USE_DMAP was introduced to replace most UMA_MD_SMALL_ALLOC uses.
Reviewed by: markj, kib Approved by: markj (mentor) Differential Revision: https://reviews.freebsd.org/D45084
show more ...
|
Revision tags: release/13.3.0, release/14.0.0 |
|
#
10db91ec |
| 12-Sep-2023 |
Doug Moore <dougm@FreeBSD.org> |
vm_radix: add a missing paren
429c871ddddac4bbf6abf1eb9e2e6603f87c2ef5 left parens unbalanced in a powerpc case that my testing missed. Restore balance.
Reported by: jenkins
|
#
429c871d |
| 12-Sep-2023 |
Doug Moore <dougm@FreeBSD.org> |
radix_trie: have vm_radix use pctrie code
Implement everything currently in vm_radix.c with calls to functions in subr_pctrie.c, asccessed via the interface provided by the DEFINE_PCTRIE_SMR macro.
radix_trie: have vm_radix use pctrie code
Implement everything currently in vm_radix.c with calls to functions in subr_pctrie.c, asccessed via the interface provided by the DEFINE_PCTRIE_SMR macro.
Add back some #includes removed in the first attempt, and avoid the use of a discontinued type in a bit of conditionally compiled code.
Reviewed by: alc, markj Tested by: pho Differential Revision: https://reviews.freebsd.org/D41344
show more ...
|
#
6cec93da |
| 11-Sep-2023 |
Doug Moore <dougm@FreeBSD.org> |
Revert "radix_trie: have vm_radix use pctrie code"
This reverts commit a494d30465f21e8cb014a5c788a43001397325d7.
|
#
a494d304 |
| 11-Sep-2023 |
Doug Moore <dougm@FreeBSD.org> |
radix_trie: have vm_radix use pctrie code
Implement everything currently in vm_radix.c with calls to functions in subr_pctrie.c, asccessed via the interface provided by the DEFINE_PCTRIE_SMR macro.
radix_trie: have vm_radix use pctrie code
Implement everything currently in vm_radix.c with calls to functions in subr_pctrie.c, asccessed via the interface provided by the DEFINE_PCTRIE_SMR macro.
Reviewed by: alc, markj Tested by: pho Differential Revision: https://reviews.freebsd.org/D41344
show more ...
|
#
685dc743 |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
#
ac0572e6 |
| 30-Jul-2023 |
Doug Moore <dougm@FreeBSD.org> |
radix_tree: compute slot from keybarr
The computation of keybarr(), the function that determines when a search has failed at a non-leaf node, can be done in a way that computes the 'slot' value when
radix_tree: compute slot from keybarr
The computation of keybarr(), the function that determines when a search has failed at a non-leaf node, can be done in a way that computes the 'slot' value when keybarr() fails, which is exactly when slot() would next be invoked. Computing things this way saves space in search loops.
This reduces the amd64 coding of the search loop in vm_radix_lookup from 40 bytes to 28 bytes.
Reviewed by: alc Tested by: pho (as part of a larger change) Differential Revision: https://reviews.freebsd.org/D41235
show more ...
|
#
38f5cb1b |
| 30-Jul-2023 |
Doug Moore <dougm@FreeBSD.org> |
radix_tree: redefine the clev field
The clev field in the node struct is almost always multiplied by WIDTH; occasionally, it is incremented and then multiplied by WIDTH. Instructions can be saved by
radix_tree: redefine the clev field
The clev field in the node struct is almost always multiplied by WIDTH; occasionally, it is incremented and then multiplied by WIDTH. Instructions can be saved by storing it always multiplied by WIDTH.
For the computation of slot(), this just eliminates a multiplication. For trimkey(), where the caller always adds one to clev before passing it as an argument, this change has the caller, not the caller, do that. Trimkey() handles it not by adding WIDTH to the input parameter, but by shifting COUNT, and not 1. That produces the same result, and it relieves keybarr of the need to test to avoid shifting by more than 63 bits, since level is always <= 63.
This takes 3 instrutions and 14 bytes out of the basic lookup loop on amd64.
Reviewed by: kib Tested by: pho (as part of a larger change) Differential Revision: https://reviews.freebsd.org/D41226
show more ...
|
#
2d2bcba7 |
| 28-Jul-2023 |
Doug Moore <dougm@FreeBSD.org> |
Every path in a radix trie ends with a leaf or a NULL. By replacing NULL (non-leaf) pointers with NULL leaves, there is a NULL test removed from every iteration of an index-based search loop.
This s
Every path in a radix trie ends with a leaf or a NULL. By replacing NULL (non-leaf) pointers with NULL leaves, there is a NULL test removed from every iteration of an index-based search loop.
This speeds up radix trie searches by few percent. If there are any radix tries that are not initialized with the init() function, but instead depend on zeroing everything being proper initialization, this will break those tries.
Reviewed by: alc, kib Tested by: pho (as part of a larger change) Differential Revision: https://reviews.freebsd.org/D41171
show more ...
|
#
6f251ef2 |
| 19-Jul-2023 |
Doug Moore <dougm@FreeBSD.org> |
radix_trie: simplify ge, le lookups
Replace the implementations of lookup_le and lookup_ge with ones that do not use a stack or climb back up the tree, and instead exploit the popmap field to quickl
radix_trie: simplify ge, le lookups
Replace the implementations of lookup_le and lookup_ge with ones that do not use a stack or climb back up the tree, and instead exploit the popmap field to quickly identify the place to resume searching if the straightforward indexed search fails.
The code size of the original functions shrinks by a combined 160 bytes on amd64, and the cumulative cycle count per invocation of the two functions together is reduced 20% in a buildworld test.
Reviewed by: alc, markj Tested by: pho Differential Revision: https://reviews.freebsd.org/D40936
show more ...
|
#
16e01c05 |
| 09-Jul-2023 |
Doug Moore <dougm@FreeBSD.org> |
radix_trie: avoid code duplication in insert
Two cases in the insert routine are written differently, when they're really doing the same thing. Writing that case only once saves 208 bytes in the com
radix_trie: avoid code duplication in insert
Two cases in the insert routine are written differently, when they're really doing the same thing. Writing that case only once saves 208 bytes in the compiled vm_radix_insert code and reduces instructions executed by about 2%. Reviewed by: alc Tested by: pho Differential Revision: https://reviews.freebsd.org/D40807
show more ...
|
#
8df38859 |
| 07-Jul-2023 |
Doug Moore <dougm@FreeBSD.org> |
radix_trie: replace node count with popmap
Replace the 'count' field in a trie node with a bitmap that identifies non-NULL children. Drop the 'last' field, and use the last bit set in the bitmap ins
radix_trie: replace node count with popmap
Replace the 'count' field in a trie node with a bitmap that identifies non-NULL children. Drop the 'last' field, and use the last bit set in the bitmap instead. In lookup_le, lookup_ge, remove, and reclaim_all, use the bitmap to find the previous/next/only/every non-null child in constant time by examining the bitmask instead of looping across array elements and null-checking them one-by-one.
A buildworld test suggests that this reduces the cycle count on those functions that eliminate some null-checks by 4.9%, 1.5%, 0.0% and 13.3%. Reviewed by: alc Tested by: pho Differential Revision: https://reviews.freebsd.org/D40775
show more ...
|
#
da72505f |
| 27-Jun-2023 |
Doug Moore <dougm@FreeBSD.org> |
radix_trie: pass fewer params to node_get
Let node_get calculate it's own owner value. Don't pass the count parameter, since it's always 2. Save 16 bytes in insert(). Move, without modifying, slot a
radix_trie: pass fewer params to node_get
Let node_get calculate it's own owner value. Don't pass the count parameter, since it's always 2. Save 16 bytes in insert(). Move, without modifying, slot and trimkey to handle use-before-declaration problem. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D40723
show more ...
|
#
9cfed089 |
| 27-Jun-2023 |
Doug Moore <dougm@FreeBSD.org> |
radix_trie: clean up overlong lines
This is purely a cosmetic change. vm_radix.c has lines that reach past column 80 and this change cleans that up. The associated changes to subr_pctrie.c are just
radix_trie: clean up overlong lines
This is purely a cosmetic change. vm_radix.c has lines that reach past column 80 and this change cleans that up. The associated changes to subr_pctrie.c are just to keep mirroring vm_radix.c. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D40764
show more ...
|
#
72c3a43b |
| 27-Jun-2023 |
Doug Moore <dougm@FreeBSD.org> |
radix_trie: skip compare in lookup_le, lookup_ge
In _lookup_ge, where a loop "looks for an available edge or val within the current bisection node" (to quote the code comment), the value of index ha
radix_trie: skip compare in lookup_le, lookup_ge
In _lookup_ge, where a loop "looks for an available edge or val within the current bisection node" (to quote the code comment), the value of index has already been modified to guarantee that it is the least value than can be found in the non-NULL child node being examined. Therefore, if the non-NULL child is a leaf, there's no need to compare 'index' to anything, and the value can just be returned.
The same is true for _lookup_le with 'most' replacing 'least'. Reviewed by: alc Tested by: pho Differential Revision: https://reviews.freebsd.org/D40746
show more ...
|
#
a42d8fe0 |
| 25-Jun-2023 |
Doug Moore <dougm@FreeBSD.org> |
radix_trie: simplify trimkey functions
Replacing a branch and two shifts with a single masking operation saves 64 bytes the pair of functions lookup_le and lookup_ge on amd64. Refresh the associate
radix_trie: simplify trimkey functions
Replacing a branch and two shifts with a single masking operation saves 64 bytes the pair of functions lookup_le and lookup_ge on amd64. Refresh the associated comments. Reviewed by: alc Differential Revision: https://reviews.freebsd.org/D40722
show more ...
|
#
e8efee29 |
| 24-Jun-2023 |
Doug Moore <dougm@FreeBSD.org> |
radix_trie: avoid reloading radix node
In the vm_radix:remove loop that searches for the last child, load that child once, without loading it again after the search is over. Change KASSERTS from ind
radix_trie: avoid reloading radix node
In the vm_radix:remove loop that searches for the last child, load that child once, without loading it again after the search is over. Change KASSERTS from index check to NULL node check. Reviewed by: alc Differential Revision: https://reviews.freebsd.org/D40721
show more ...
|
#
1efa7dbc |
| 21-Jun-2023 |
Doug Moore <dougm@FreeBSD.org> |
vm_radix: drop unused function; use bool.
Replace boolean_t with bool in vm_radix.c. Drop the unused function vm_radix_is_singleton, which is unused and has no corresponding function in subr_pctrie.
vm_radix: drop unused function; use bool.
Replace boolean_t with bool in vm_radix.c. Drop the unused function vm_radix_is_singleton, which is unused and has no corresponding function in subr_pctrie.c. Reviewed by: alc Differential Revision: <https://reviews.freebsd.org/D40586>
show more ...
|
#
05963ea4 |
| 20-Jun-2023 |
Doug Moore <dougm@FreeBSD.org> |
radix_trie: eliminate iteration in keydiff
Use flsll(), instead of a loop, to find where two keys differ, and then arithmetic to transform that to a trie level. Approved by: alc, markj Differential
radix_trie: eliminate iteration in keydiff
Use flsll(), instead of a loop, to find where two keys differ, and then arithmetic to transform that to a trie level. Approved by: alc, markj Differential Revision: https://reviews.freebsd.org/D40585
show more ...
|
#
4d846d26 |
| 10-May-2023 |
Warner Losh <imp@FreeBSD.org> |
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause.
Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
show more ...
|
Revision tags: release/13.2.0, release/12.4.0, release/13.1.0, release/12.3.0, release/13.0.0, release/12.2.0 |
|
#
c3aa3bf9 |
| 01-Sep-2020 |
Mateusz Guzik <mjg@FreeBSD.org> |
vm: clean up empty lines in .c and .h files
|
Revision tags: release/11.4.0 |
|
#
c79cee71 |
| 13-May-2020 |
Kyle Evans <kevans@FreeBSD.org> |
kernel: provide panicky version of __unreachable
__builtin_unreachable doesn't raise any compile-time warnings/errors on its own, so problems with its usage can't be easily detected. While it would
kernel: provide panicky version of __unreachable
__builtin_unreachable doesn't raise any compile-time warnings/errors on its own, so problems with its usage can't be easily detected. While it would be nice for this situation to change and compilers to at least add a warning for trivial cases where local state means the instruction can't be reached, this isn't the case at the moment and likely will not happen.
This commit adds an __assert_unreachable, whose intent is incredibly clear: it asserts that this instruction is unreachable. On INVARIANTS builds, it's a panic(), and on non-INVARIANTS it expands to __unreachable().
Existing users of __unreachable() are converted to __assert_unreachable, to improve debuggability if this assumption is violated.
Reviewed by: mjg Differential Revision: https://reviews.freebsd.org/D23793
show more ...
|
#
2ac6b71f |
| 07-Mar-2020 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r358712 through r358730.
|
#
3fba8868 |
| 07-Mar-2020 |
Mark Johnston <markj@FreeBSD.org> |
Move SMR pointer type definition and access macros to smr_types.h.
The intent is to provide a header that can be included by other headers without introducing too much pollution. smr.h depends on v
Move SMR pointer type definition and access macros to smr_types.h.
The intent is to provide a header that can be included by other headers without introducing too much pollution. smr.h depends on various headers and will likely grow over time, but is less likely to be required by system headers.
Rename SMR_TYPE_DECLARE() to SMR_POINTER(): - One might use SMR to protect more than just pointers; it could be used for resizeable arrays, for example, so TYPE seems too generic. - It is useful to be able to define anonymous SMR-protected pointer types and the _DECLARE suffix makes that look wrong.
Reviewed by: jeff, mjg, rlibby Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D23988
show more ...
|
#
5d25f943 |
| 23-Feb-2020 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r358239 through r358262.
|