tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Very slow transfers to/from micro SD card on a RPi B+



2016-01-04 17:26 GMT+01:00 Stephan <stephanwib%googlemail.com@localhost>:
> There is another issue with the Pi which I recognized when /etc/daily
> runs. The "find / -<blah blah>" jobs causes certain threads to hang
> for a long time. That´s easily reproducable by issuing "find / >
> /dev/null &". In the test I just made, I issued "ps" while the job
> ran.
>
>
> Any ideas?
>

I found out what is wrong. The issue is that the filesystem updates
the atime of all the files accessed at a certain point. "iostat -x"
shows that all reads stall while threre are only writes of 16kb
extents, as shown below:

device  read KB/t    r/s   time     MB/s write KB/t    w/s   time     MB/s
ld0          2.49    758   0.42     1.84       0.00      0   0.42     0.00
ld0          2.14    798   0.43     1.67       0.00      0   0.43     0.00
ld0          2.40    777   0.44     1.82       0.00      0   0.44     0.00
ld0          2.00    775   0.43     1.51       0.00      0   0.43     0.00
ld0          2.97    749   0.46     2.17       0.00      0   0.46     0.00
ld0          4.26    644   0.40     2.68       0.00      0   0.40     0.00
ld0          2.86    723   0.34     2.02       0.00      0   0.34     0.00
ld0          2.00    796   0.42     1.55       0.00      0   0.42     0.00
ld0          2.00    520   0.64     1.02      60.82     25   0.64     1.47
ld0          2.00     72   0.59     0.14      36.68    162   0.59     5.82
ld0          0.00      0   1.08     0.00      16.00      1   1.08     0.02
ld0          0.00      0   1.11     0.00      16.00     20   1.11     0.31
ld0          0.00      0   1.05     0.00      16.00      1   1.05     0.02
ld0          0.00      0   0.49     0.00      16.00      2   0.49     0.03
ld0          0.00      0   1.61     0.00      16.00      1   1.61     0.02
ld0          0.00      0   1.06     0.00      16.00     58   1.06     0.91
ld0          0.00      0   0.35     0.00      16.00     85   0.35     1.33
ld0          0.00      0   1.05     0.00      16.00      1   1.05     0.02
ld0          0.00      0   1.07     0.00      16.00      7   1.07     0.11
ld0          0.00      0   1.07     0.00      16.00      1   1.07     0.02
ld0          0.00      0   1.48     0.00      16.00     98   1.48     1.53

During these writes, the stack of the ioflush thread looks like this
most of the time:

crash> t/a 9bd45be0
trace: pid 0 lid 43 at 0x9bd47ddc
0x9bd47ddc: mi_switch+0xc
0x9bd47e04: sleepq_block+0x9c
0x9bd47e2c: turnstile_block+0x2a4
0x9bd47e8c: rw_enter+0x140
0x9bd47ea4: wapbl_begin+0x74
0x9bd47f04: ffs_sync+0x1d4
0x9bd47f14: VFS_SYNC+0x18
0x9bd47f34: sync_fsync+0x7c
0x9bd47f64: VOP_FSYNC+0x44
0x9bd47fac: sched_sync+0x10c

The slowness of these writes might be related to the access pattern to
the SD card and its inner workings, segment sizes and alignment
desires :-)

A way to circumvent these hangs is to remount the filesystem with noatime.


Home | Main Index | Thread Index | Old Index