This repository was archived by the owner on Feb 16, 2026. It is now read-only.
Commit 445a843
committed
cache_hash: scale the private_oh
With a lot of objects on the private objhead, the mtx would become contended.
We solve this contention by using an array of private objheads and spreading
objects over the array elements using a fibonacci hash.
The choice of an array of objheads rather than an array of objhead pointers is
motivated by hsh_deref_objhead_unlock(), which behaves differently for private
objects. An alternative to the address check would be to add a flag field to
struct objhead, but that would require to grow the struct (really not a good
option for such a central data structure which, in many cases, is required once
per object) or reduce the size of the magic value to 16 bits.
The drawback of the chosen solution is that flexelint thinks all objheads would
need to be from the array, and hence reports out of bounds access all over the
place. These warnings are suppressed somehow specifically (see comment inline).1 parent be83e3d commit 445a843
1 file changed
Lines changed: 37 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
| 77 | + | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| |||
137 | 138 | | |
138 | 139 | | |
139 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
140 | 154 | | |
141 | 155 | | |
142 | 156 | | |
143 | 157 | | |
| 158 | + | |
144 | 159 | | |
145 | | - | |
| 160 | + | |
| 161 | + | |
146 | 162 | | |
147 | 163 | | |
148 | 164 | | |
149 | 165 | | |
150 | | - | |
| 166 | + | |
151 | 167 | | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
156 | 172 | | |
157 | 173 | | |
158 | 174 | | |
| |||
1114 | 1130 | | |
1115 | 1131 | | |
1116 | 1132 | | |
1117 | | - | |
| 1133 | + | |
1118 | 1134 | | |
1119 | 1135 | | |
1120 | 1136 | | |
1121 | 1137 | | |
1122 | 1138 | | |
1123 | 1139 | | |
1124 | 1140 | | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
1125 | 1148 | | |
1126 | 1149 | | |
1127 | 1150 | | |
| |||
1157 | 1180 | | |
1158 | 1181 | | |
1159 | 1182 | | |
1160 | | - | |
1161 | | - | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
1162 | 1189 | | |
0 commit comments