Commit 309e02d
ublk: avoid unpinning pages under maple tree spinlock
ublk_shmem_remove_ranges() calls unpin_user_pages() while holding the
maple tree spinlock (mas_lock). Although unpin_user_pages() is safe in
atomic context, holding the spinlock across potentially many page
unpinning operations is not ideal.
Split into __ublk_shmem_remove_ranges() which erases up to 64 ranges
under mas_lock, collecting base_pfn and nr_pages into a temporary
xarray. Then drop the lock and unpin pages outside spinlock context.
ublk_shmem_remove_ranges() loops until all matching ranges are
processed.
Signed-off-by: Ming Lei <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jens Axboe <[email protected]>1 parent ea1db79 commit 309e02d
1 file changed
Lines changed: 46 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5441 | 5441 | | |
5442 | 5442 | | |
5443 | 5443 | | |
5444 | | - | |
5445 | | - | |
| 5444 | + | |
| 5445 | + | |
| 5446 | + | |
| 5447 | + | |
| 5448 | + | |
| 5449 | + | |
5446 | 5450 | | |
5447 | | - | |
| 5451 | + | |
| 5452 | + | |
| 5453 | + | |
| 5454 | + | |
5448 | 5455 | | |
5449 | 5456 | | |
5450 | 5457 | | |
5451 | | - | |
| 5458 | + | |
| 5459 | + | |
| 5460 | + | |
| 5461 | + | |
| 5462 | + | |
| 5463 | + | |
| 5464 | + | |
5452 | 5465 | | |
5453 | 5466 | | |
5454 | 5467 | | |
5455 | | - | |
| 5468 | + | |
5456 | 5469 | | |
5457 | 5470 | | |
5458 | 5471 | | |
5459 | 5472 | | |
5460 | | - | |
5461 | | - | |
5462 | | - | |
| 5473 | + | |
| 5474 | + | |
| 5475 | + | |
| 5476 | + | |
| 5477 | + | |
5463 | 5478 | | |
5464 | | - | |
5465 | | - | |
5466 | 5479 | | |
| 5480 | + | |
| 5481 | + | |
5467 | 5482 | | |
| 5483 | + | |
| 5484 | + | |
5468 | 5485 | | |
5469 | 5486 | | |
| 5487 | + | |
| 5488 | + | |
| 5489 | + | |
| 5490 | + | |
| 5491 | + | |
| 5492 | + | |
| 5493 | + | |
| 5494 | + | |
| 5495 | + | |
| 5496 | + | |
| 5497 | + | |
| 5498 | + | |
| 5499 | + | |
| 5500 | + | |
| 5501 | + | |
| 5502 | + | |
| 5503 | + | |
| 5504 | + | |
| 5505 | + | |
5470 | 5506 | | |
5471 | 5507 | | |
5472 | 5508 | | |
| |||
0 commit comments