Commit e101840
mm:zsmalloc: drop class lock before freeing zspage
Currently in zs_free(), the class->lock is held until the zspage is
completely freed and the counters are updated. However, freeing pages back
to the buddy allocator requires acquiring the zone lock.
Under heavy memory pressure, zone lock contention can be severe. When this
happens, the CPU holding the class->lock will stall waiting for the zone
lock, thereby blocking all other CPUs attempting to acquire the same
class->lock.
This patch shrinks the critical section of the class->lock to reduce lock
contention. By moving the actual page freeing process outside the
class->lock, we can improve the concurrency performance of zs_free().
Testing on the RADXA O6 platform shows that with 12 CPUs concurrently
performing zs_free() operations, the execution time is reduced by 20%.
Signed-off-by: Xueyuan Chen <[email protected]>
Signed-off-by: Wenchao Hao <[email protected]>1 parent 857ada9 commit e101840
1 file changed
Lines changed: 22 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
801 | 801 | | |
802 | 802 | | |
803 | 803 | | |
804 | | - | |
805 | | - | |
| 804 | + | |
806 | 805 | | |
807 | 806 | | |
808 | 807 | | |
809 | | - | |
810 | | - | |
811 | 808 | | |
812 | 809 | | |
813 | 810 | | |
| |||
823 | 820 | | |
824 | 821 | | |
825 | 822 | | |
| 823 | + | |
826 | 824 | | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
827 | 830 | | |
828 | 831 | | |
829 | 832 | | |
| |||
1388 | 1391 | | |
1389 | 1392 | | |
1390 | 1393 | | |
| 1394 | + | |
1391 | 1395 | | |
1392 | 1396 | | |
1393 | 1397 | | |
| |||
1408 | 1412 | | |
1409 | 1413 | | |
1410 | 1414 | | |
1411 | | - | |
1412 | | - | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
1413 | 1424 | | |
1414 | 1425 | | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
1415 | 1431 | | |
1416 | 1432 | | |
1417 | 1433 | | |
| |||
0 commit comments