Commit 2df5338
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]>1 parent 79d3e84 commit 2df5338
1 file changed
Lines changed: 46 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5433 | 5433 | | |
5434 | 5434 | | |
5435 | 5435 | | |
5436 | | - | |
5437 | | - | |
| 5436 | + | |
| 5437 | + | |
| 5438 | + | |
| 5439 | + | |
| 5440 | + | |
| 5441 | + | |
5438 | 5442 | | |
5439 | | - | |
| 5443 | + | |
| 5444 | + | |
| 5445 | + | |
| 5446 | + | |
5440 | 5447 | | |
5441 | 5448 | | |
5442 | 5449 | | |
5443 | | - | |
| 5450 | + | |
| 5451 | + | |
| 5452 | + | |
| 5453 | + | |
| 5454 | + | |
| 5455 | + | |
| 5456 | + | |
5444 | 5457 | | |
5445 | 5458 | | |
5446 | 5459 | | |
5447 | | - | |
| 5460 | + | |
5448 | 5461 | | |
5449 | 5462 | | |
5450 | 5463 | | |
5451 | 5464 | | |
5452 | | - | |
5453 | | - | |
5454 | | - | |
| 5465 | + | |
| 5466 | + | |
| 5467 | + | |
| 5468 | + | |
| 5469 | + | |
5455 | 5470 | | |
5456 | | - | |
5457 | | - | |
5458 | 5471 | | |
| 5472 | + | |
| 5473 | + | |
5459 | 5474 | | |
| 5475 | + | |
| 5476 | + | |
5460 | 5477 | | |
5461 | 5478 | | |
| 5479 | + | |
| 5480 | + | |
| 5481 | + | |
| 5482 | + | |
| 5483 | + | |
| 5484 | + | |
| 5485 | + | |
| 5486 | + | |
| 5487 | + | |
| 5488 | + | |
| 5489 | + | |
| 5490 | + | |
| 5491 | + | |
| 5492 | + | |
| 5493 | + | |
| 5494 | + | |
| 5495 | + | |
| 5496 | + | |
| 5497 | + | |
5462 | 5498 | | |
5463 | 5499 | | |
5464 | 5500 | | |
| |||
0 commit comments