Make the tree search in iommu_gas_lowermatch a symmetric reflection of the one in iommu_gas_uppermatch. That makes it a last-fit search.
Details
In a GENERIC-NODEBUG kernel, the command netperf -H lip3 -t TCP_MAERTS -D 1 repeated 6 times on the modified code produced these lines:
Recv Send Send
Socket Socket Message Elapsed
Size Size Size Time Throughput
bytes bytes bytes secs. 10^6bits/sec
65536 32768 32768 10.00 3959.37
65536 32768 32768 10.00 3953.41
65536 32768 32768 10.00 3636.69
65536 32768 32768 10.00 3603.06
65536 32768 32768 10.00 3909.86
65536 32768 32768 10.00 3914.47
and on the unmodified code produced these lines:
65536 32768 32768 10.00 3544.47
65536 32768 32768 10.00 3298.67
65536 32768 32768 10.00 3464.01
65536 32768 32768 10.00 3259.26
65536 32768 32768 10.00 3448.33
65536 32768 32768 10.00 3420.01
With modifications that count the number of node accesses in find_space search, these counts and bandwidth measures were found:
Original lowermatch:
hw.iommu.gas_lookup: 311343
65536 32768 32768 10.00 1965.28
hw.iommu.gas_lookup: 42073095
65536 32768 32768 10.00 1876.73
hw.iommu.gas_lookup: 83155722
65536 32768 32768 10.00 1841.73
hw.iommu.gas_lookup: 125178468
65536 32768 32768 10.00 1841.57
hw.iommu.gas_lookup: 174081170
65536 32768 32768 10.00 1913.67
hw.iommu.gas_lookup: 218310999
65536 32768 32768 10.00 1899.92
hw.iommu.gas_lookup: 262407635
Rewritten lowermatch:
hw.iommu.gas_lookup: 138495
65536 32768 32768 10.00 2209.42
hw.iommu.gas_lookup: 27866367
65536 32768 32768 10.00 2160.35
hw.iommu.gas_lookup: 55194727
65536 32768 32768 10.00 2047.06
hw.iommu.gas_lookup: 81110078
65536 32768 32768 10.00 2052.06
hw.iommu.gas_lookup: 107193858
65536 32768 32768 10.00 2034.69
hw.iommu.gas_lookup: 133261857
65536 32768 32768 10.00 2125.24
hw.iommu.gas_lookup: 160194638
Diff Detail
- Lint
Lint Skipped - Unit
Tests Skipped