When writing to SSD (regardless if over file system or directly into /dev/sda) I observe extremely high CPU usage, with top showing

CPU:   0% usr  53% sys   0% nic   9% idle  27% io   0% irq   9% sirq

and the readprofile showing

   826 __softirqentry_text_start                  1.5410
     6 ret_fast_syscall                           0.0405
    28 el0_svc_naked                              0.7000
     7 ni_sys                                     0.5833
     3 fpsimd_restore_current_state               0.0139
     4 fpsimd_load_state                          0.0400
     1 do_notify_resume                           0.0040
     0 *unknown*
   875 total                                      0.0104

while /proc/interrupts (rebooted immediately before the test) showing the line

 31:     305407          0     GICv2 165 Level     ahci-ceva[fd0c0000.ahci]

(let me known if other lines in its lengthy output are relevant).

The kernel is the customized Linux buildroot 4.14.0 running on aarch64.

The benchmarking code writes 100000 data chunks 1 Mb each to /dev/sda in totally ambition-less way:

char buffer[chunkSize];
FILE * file = fopen("/dev/sda", "wb");
for (uint32_t slice = 0; slice < slicecount; slice++) {
    fwrite(buffer, chunkSize, 1, file);

The hdparm -I reports

    DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6
            Cycle time: min=120ns recommended=120ns
    PIO: pio0 pio1 pio2 pio3 pio4

Hence it is not PIO and in general I cannot change it:

# hdparm -X udma5 /dev/sdb

 setting xfermode to 69
 (UltraDMA mode5)
hdparm: HDIO_DRIVE_CMD: Input/output error

We cannot achieve the required data transfer rate on the device just because the CPU is not fast enough. This rate is about 500 Mb/s and the drives are checked to support this on desktop machine with better CPU, but the device can only do about 300.

I was always so convinced that SATA uses DMA, and DMA does not need much of the CPU time!

What is going on? Can we do anything about to fix it?

There is a similar question for Xubuntu but we have a very different architecture, there is no explaining answer there anyway and I add much more diagnostics. Adding pcie_aspm=off to kernel parameters was not helpful in our case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.