forked fromtorvalds/linux
- Notifications
You must be signed in to change notification settings - Fork0
Commitf611e8c
lockdep: Take read/write status in consideration when generate chainkey
Currently, the chainkey of a lock chain is a hash sum of the class_idxof all the held locks, the read/write status are not taken in toconsideration while generating the chainkey. This could result into aproblem, if we have:P1(){read_lock(B);lock(A);}P2(){lock(A);read_lock(B);}P3(){lock(A);write_lock(B);}, and P1(), P2(), P3() run one by one. And when running P2(), lockdepdetects such a lock chain A -> B is not a deadlock, then it's added inthe chain cache, and then when running P3(), even if it's a deadlock, wecould miss it because of the hit of chain cache. This could be confirmedby self testcase "chain cached mixed R-L/L-W ".To resolve this, we use concept "hlock_id" to generate the chainkey, thehlock_id is a tuple (hlock->class_idx, hlock->read), which fits in a u16type. With this, the chainkeys are different is the lock sequences havethe same locks but different read/write status.Besides, since we use "hlock_id" to generate chainkeys, the chain_hlocksarray now store the "hlock_id"s rather than lock_class indexes.Signed-off-by: Boqun Feng <boqun.feng@gmail.com>Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>Link:https://lkml.kernel.org/r/20200807074238.1632519-15-boqun.feng@gmail.com1 parentd4f200e commitf611e8c
1 file changed
+35
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
371 | 371 | | |
372 | 372 | | |
373 | 373 | | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
374 | 389 | | |
375 | 390 | | |
376 | 391 | | |
| |||
3202 | 3217 | | |
3203 | 3218 | | |
3204 | 3219 | | |
3205 | | - | |
| 3220 | + | |
| 3221 | + | |
| 3222 | + | |
| 3223 | + | |
3206 | 3224 | | |
3207 | 3225 | | |
3208 | 3226 | | |
| |||
3228 | 3246 | | |
3229 | 3247 | | |
3230 | 3248 | | |
3231 | | - | |
| 3249 | + | |
3232 | 3250 | | |
3233 | | - | |
| 3251 | + | |
3234 | 3252 | | |
3235 | | - | |
3236 | | - | |
| 3253 | + | |
| 3254 | + | |
3237 | 3255 | | |
3238 | 3256 | | |
3239 | 3257 | | |
| |||
3250 | 3268 | | |
3251 | 3269 | | |
3252 | 3270 | | |
3253 | | - | |
| 3271 | + | |
3254 | 3272 | | |
3255 | 3273 | | |
3256 | 3274 | | |
3257 | 3275 | | |
3258 | | - | |
| 3276 | + | |
3259 | 3277 | | |
3260 | 3278 | | |
3261 | 3279 | | |
3262 | 3280 | | |
3263 | 3281 | | |
3264 | 3282 | | |
3265 | 3283 | | |
3266 | | - | |
| 3284 | + | |
3267 | 3285 | | |
3268 | 3286 | | |
3269 | 3287 | | |
3270 | | - | |
3271 | | - | |
| 3288 | + | |
| 3289 | + | |
3272 | 3290 | | |
3273 | | - | |
| 3291 | + | |
3274 | 3292 | | |
3275 | 3293 | | |
3276 | 3294 | | |
| |||
3319 | 3337 | | |
3320 | 3338 | | |
3321 | 3339 | | |
3322 | | - | |
| 3340 | + | |
3323 | 3341 | | |
3324 | 3342 | | |
3325 | 3343 | | |
| |||
3368 | 3386 | | |
3369 | 3387 | | |
3370 | 3388 | | |
3371 | | - | |
3372 | 3389 | | |
3373 | 3390 | | |
3374 | 3391 | | |
| |||
3411 | 3428 | | |
3412 | 3429 | | |
3413 | 3430 | | |
3414 | | - | |
| 3431 | + | |
3415 | 3432 | | |
3416 | 3433 | | |
3417 | 3434 | | |
3418 | | - | |
| 3435 | + | |
3419 | 3436 | | |
3420 | 3437 | | |
3421 | 3438 | | |
| |||
3602 | 3619 | | |
3603 | 3620 | | |
3604 | 3621 | | |
3605 | | - | |
| 3622 | + | |
3606 | 3623 | | |
3607 | 3624 | | |
3608 | 3625 | | |
| |||
4749 | 4766 | | |
4750 | 4767 | | |
4751 | 4768 | | |
4752 | | - | |
| 4769 | + | |
4753 | 4770 | | |
4754 | 4771 | | |
4755 | 4772 | | |
| |||
5648 | 5665 | | |
5649 | 5666 | | |
5650 | 5667 | | |
5651 | | - | |
| 5668 | + | |
5652 | 5669 | | |
5653 | 5670 | | |
5654 | 5671 | | |
| |||
0 commit comments
Comments
(0)