On 12/05/2015 12:19, Denis V. Lunev wrote:
> 
> 
> hades /vol $ strace -f -e pwrite -e raw=write,pwrite  qemu-io -n -c
> "write -P 0x11 0 64M" ./1.img
> Process 19326 attached
> [pid 19326] pwrite(0x6, 0x7fac07fff200, 0x4000000, 0x50000) = 0x4000000
> <---- 1 GB Write from userspace

FWIW this is 64 MB (as expected).

> wrote 67108864/67108864 bytes at offset 0
> 64 MiB, 1 ops; 0.2964 sec (215.863 MiB/sec and 3.3729 ops/sec)
> [pid 19326] +++ exited with 0 +++
> +++ exited with 0 +++
> hades /vol $

>   9,0    1      266    74.030359772 19326  Q  WS 473095 + 1016 [(null)]
>   9,0    1      267    74.030361546 19326  Q  WS 474111 + 8 [(null)]
>   9,0    1      268    74.030395522 19326  Q  WS 474119 + 1016 [(null)]
>   9,0    1      269    74.030397509 19326  Q  WS 475135 + 8 [(null)]
> 
> This means, yes, kernel is INEFFECTIVE performing direct IO with
> not aligned address. For example, without direct IO the pattern is
> much better. 

I think this means that the kernel is DMAing at most 128 pages at a
time.  If the buffer is misaligned, you need 129 pages and the kernel
then splits the request into a 128 page and a 1 page part.

This looks like a hardware limit, and the kernel probably cannot really
do anything about it because we requested O_DIRECT.  So your patch makes
sense.

Paolo

Reply via email to