Commit c39dda0
mshv: Add refcount and locking to mem regions
Introduce kref-based reference counting and spinlock protection for
memory regions in Hyper-V partition management. This change improves
memory region lifecycle management and ensures thread-safe access to the
region list.
Previously, the regions list was protected by the partition mutex.
However, this approach is too heavy for frequent fault and invalidation
operations. Finer grained locking is now used to improve efficiency and
concurrency.
This is a precursor to supporting movable memory regions. Fault and
invalidation handling for movable regions will require safe traversal of
the region list and holding a region reference while performing
invalidation or fault operations.
Signed-off-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>1 parent abceb42 commit c39dda0
3 files changed
Lines changed: 45 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
154 | 155 | | |
155 | 156 | | |
156 | 157 | | |
| 158 | + | |
| 159 | + | |
157 | 160 | | |
158 | 161 | | |
159 | 162 | | |
| |||
311 | 314 | | |
312 | 315 | | |
313 | 316 | | |
314 | | - | |
| 317 | + | |
315 | 318 | | |
| 319 | + | |
| 320 | + | |
316 | 321 | | |
317 | 322 | | |
318 | 323 | | |
319 | | - | |
320 | | - | |
321 | 324 | | |
322 | 325 | | |
323 | 326 | | |
| |||
334 | 337 | | |
335 | 338 | | |
336 | 339 | | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
| |||
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
| 101 | + | |
| 102 | + | |
100 | 103 | | |
101 | 104 | | |
102 | 105 | | |
| |||
319 | 322 | | |
320 | 323 | | |
321 | 324 | | |
322 | | - | |
| 325 | + | |
| 326 | + | |
323 | 327 | | |
324 | 328 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1086 | 1086 | | |
1087 | 1087 | | |
1088 | 1088 | | |
| 1089 | + | |
1089 | 1090 | | |
1090 | 1091 | | |
1091 | 1092 | | |
1092 | 1093 | | |
1093 | | - | |
| 1094 | + | |
1094 | 1095 | | |
1095 | 1096 | | |
| 1097 | + | |
1096 | 1098 | | |
1097 | 1099 | | |
1098 | 1100 | | |
| |||
1224 | 1226 | | |
1225 | 1227 | | |
1226 | 1228 | | |
1227 | | - | |
| 1229 | + | |
1228 | 1230 | | |
| 1231 | + | |
1229 | 1232 | | |
1230 | 1233 | | |
1231 | 1234 | | |
| |||
1244 | 1247 | | |
1245 | 1248 | | |
1246 | 1249 | | |
| 1250 | + | |
| 1251 | + | |
1247 | 1252 | | |
1248 | | - | |
1249 | | - | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
1250 | 1257 | | |
1251 | 1258 | | |
1252 | 1259 | | |
1253 | 1260 | | |
1254 | | - | |
| 1261 | + | |
| 1262 | + | |
1255 | 1263 | | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
1256 | 1267 | | |
1257 | | - | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
1258 | 1271 | | |
1259 | 1272 | | |
1260 | 1273 | | |
| |||
1657 | 1670 | | |
1658 | 1671 | | |
1659 | 1672 | | |
1660 | | - | |
1661 | | - | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
1662 | 1677 | | |
1663 | 1678 | | |
1664 | 1679 | | |
| |||
1856 | 1871 | | |
1857 | 1872 | | |
1858 | 1873 | | |
| 1874 | + | |
1859 | 1875 | | |
1860 | 1876 | | |
1861 | 1877 | | |
| |||
0 commit comments