dmaengine: ti: k3-udma: Try to use the highest TPL channels for MEM_TO_MEM
authorPeter Ujfalusi <peter.ujfalusi@ti.com>
Thu, 29 Nov 2018 08:06:42 +0000 (10:06 +0200)
committerTero Kristo <t-kristo@ti.com>
Mon, 3 Dec 2018 18:47:10 +0000 (20:47 +0200)
When running memcpy test with big buffers:

echo 800000 > /sys/module/dmatest/parameters/test_buf_size
echo 2000 > /sys/module/dmatest/parameters/timeout
echo 20 > /sys/module/dmatest/parameters/iterations
echo 10 > /sys/module/dmatest/parameters/max_channels
echo 1 > /sys/module/dmatest/parameters/run

The throughput with normal channels is:
dmatest: dma1chan2-copy0: summary 200 tests, 0 failures 87 iops 308840 KB/s (0)

Using High Throughput channel with the same setup:
dmatest: dma1chan2-copy0: summary 200 tests, 0 failures 295 iops 1206172 KB/s (0)

The speed increase is about 4x.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
drivers/dma/ti/k3-udma.c

index e370a59bde36db32ce46914ba325b637612e5fe1..261a152a3cdf92a55b70a44adf173ca9f191906d 100644 (file)
@@ -1216,6 +1216,7 @@ static int udma_get_rchan(struct udma_chan *uc)
 static int udma_get_chan_pair(struct udma_chan *uc)
 {
        struct udma_dev *ud = uc->ud;
+       struct udma_match_data *match_data = ud->match_data;
        int chan_id, end;
 
        if ((uc->tchan && uc->rchan) && uc->tchan->id == uc->rchan->id) {
@@ -1236,8 +1237,9 @@ static int udma_get_chan_pair(struct udma_chan *uc)
 
        /* Can be optimized, but let's have it like this for now */
        end = min(ud->tchan_cnt, ud->rchan_cnt);
-       for (chan_id = ud->match_data->level_start_idx[UDMA_TP_NORMAL];
-            chan_id < end; chan_id++) {
+       /* Try to use the highest TPL channel pair for MEM_TO_MEM channels */
+       chan_id = match_data->level_start_idx[match_data->tpl_levels - 1];
+       for (; chan_id < end; chan_id++) {
                if (!test_bit(chan_id, ud->tchan_map) &&
                    !test_bit(chan_id, ud->rchan_map))
                        break;