Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

specialize io::copy to use copy_file_range, splice or sendfile #75272

Merged
merged 13 commits into from
Nov 14, 2020

Commits on Nov 13, 2020

  1. specialize io::copy to use copy_file_range, splice or sendfile

    Currently it only applies to linux systems. It can be extended to make use
    of similar syscalls on other unix systems.
    the8472 committed Nov 13, 2020
    Configuration menu
    Copy the full SHA
    1623647 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5eb88fa View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    67a6059 View commit details
    Browse the repository at this point in the history
  4. prioritize sendfile over splice since it results in fewer context swi…

    …tches when sending to pipes
    
    splice returns to userspace when the pipe is full, sendfile
    just blocks until it's done, this can achieve much higher throughput
    the8472 committed Nov 13, 2020
    Configuration menu
    Copy the full SHA
    cd3bddc View commit details
    Browse the repository at this point in the history
  5. add forwarding specializations for &mut variants

    `impl Write for &mut T where T: Write`, thus the same should
    apply to the specialization traits
    the8472 committed Nov 13, 2020
    Configuration menu
    Copy the full SHA
    0624730 View commit details
    Browse the repository at this point in the history
  6. reduce syscalls by inferring FD types based on source struct instead …

    …of calling stat()
    
    also adds handling for edge-cases involving large sparse files where sendfile could fail with EOVERFLOW
    the8472 committed Nov 13, 2020
    Configuration menu
    Copy the full SHA
    46e7fbe View commit details
    Browse the repository at this point in the history
  7. add benchmarks

    the8472 committed Nov 13, 2020
    Configuration menu
    Copy the full SHA
    ad9b07c View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    7f5d272 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    18bfe2a View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    888b103 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    3dfc377 View commit details
    Browse the repository at this point in the history
  12. do direct splice syscall and probe availability to get android builds…

    … to work
    
    Android builds use feature level 14, the libc wrapper for splice is gated
    on feature level 21+ so we have to invoke the syscall directly.
    Additionally the emulator doesn't seem to support it so we also have to
    add ENOSYS checks.
    the8472 committed Nov 13, 2020
    Configuration menu
    Copy the full SHA
    4854d41 View commit details
    Browse the repository at this point in the history
  13. Always handle EOVERFLOW by falling back to the generic copy loop

    Previously EOVERFLOW handling was only applied for io::copy specialization
    but not for fs::copy sharing the same code.
    
    Additionally we lower the chunk size to 1GB since we have a user report
    that older kernels may return EINVAL when passing 0x8000_0000
    but smaller values succeed.
    the8472 committed Nov 13, 2020
    Configuration menu
    Copy the full SHA
    bbfa92c View commit details
    Browse the repository at this point in the history