Commit cc90bc3
block, bfq: don't grab queue_lock from io path
Currently issue io can grab queue_lock three times from bfq_bio_merge(),
bfq_limit_depth() and bfq_prepare_request(), the queue_lock is not
necessary if icq is already created:
- queue_usage_counter is already grabbed and queue won't exist;
- current thread won't exist;
- if other thread is allocating and inserting new icq to ioc->icq_tree,
rcu can be used to protect lookup icq from the raidx tree, it's safe
to use extracted icq until queue or current thread exit;
If ioc or icq is not created, then bfq_prepare_request() will create it,
which means the task is issuing io to queue the first time, this can
consider a slow path and queue_lock will still be held to protect
inserting allocated icq to ioc->icq_tree.
Signed-off-by: Yu Kuai <[email protected]>1 parent 3c8e29e commit cc90bc3
3 files changed
Lines changed: 46 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
454 | 454 | | |
455 | 455 | | |
456 | 456 | | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
| 457 | + | |
462 | 458 | | |
463 | | - | |
464 | | - | |
465 | | - | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
466 | 462 | | |
467 | | - | |
| 463 | + | |
468 | 464 | | |
469 | 465 | | |
470 | 466 | | |
| |||
2456 | 2452 | | |
2457 | 2453 | | |
2458 | 2454 | | |
| 2455 | + | |
| 2456 | + | |
2459 | 2457 | | |
2460 | 2458 | | |
2461 | | - | |
2462 | | - | |
2463 | | - | |
2464 | | - | |
2465 | | - | |
2466 | | - | |
2467 | | - | |
2468 | | - | |
2469 | 2459 | | |
2470 | 2460 | | |
2471 | 2461 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
317 | | - | |
| 317 | + | |
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
| |||
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
344 | | - | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
345 | 378 | | |
346 | 379 | | |
347 | 380 | | |
| |||
420 | 453 | | |
421 | 454 | | |
422 | 455 | | |
423 | | - | |
424 | | - | |
425 | | - | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
426 | 459 | | |
427 | 460 | | |
428 | 461 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
451 | 451 | | |
452 | 452 | | |
453 | 453 | | |
454 | | - | |
| 454 | + | |
455 | 455 | | |
456 | 456 | | |
457 | 457 | | |
| |||
0 commit comments