Announcement

Collapse
No announcement yet.

Readfile System Call Patches Revisited For Efficiently Reading Small Files

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #11
    Originally posted by cl333r View Post
    Besides this being a one liner to use how else would it be different (efficiency-wise) from an io_uring implementation?
    Havent looked at the implementation, but this could be done without file-descriptors (finite resource), making it more robust against certain attacks, particularly when it comes to error handlers.

    Comment


    • #12
      Originally posted by coder View Post
      Uh, I'm a little triggered by seeing flags. I sure hope there's no need for O_CLOEXEC (i.e. that it's implied or unnecessary), because that'd make it not so atomic.
      Not adding flags always ends up in regret and a weird syscall2 interface being added later on (for Windows it would be SyscallEx). It's rather sensible to do it from the get go.

      Comment


      • #13
        I'm still thinking io_uring is closer. We essentially want batched syscall submission and possibly limited in-kernel code execution to cover such cases with a good degree of generality. It's a bit like BPF in those regards and could potentially improve a lot of workloads beyond this particular use case.

        Comment


        • #14
          Originally posted by edgmnt View Post
          I'm still thinking io_uring is closer. We essentially want batched syscall submission and possibly limited in-kernel code execution to cover such cases with a good degree of generality. It's a bit like BPF in those regards and could potentially improve a lot of workloads beyond this particular use case.
          readfile here is mainly designed for monitor program that needs to constantly open and read /proc or /sys
          The former will have new dir created every time a new process is created and that needs a readfile.

          Some of the files might not support seek, which means you need to close and re-open it.
          Using io-uring certainly can improve this, but you would still need multiple io_submit syscalls unless you created the uring with flag IORING_SETUP_SQPOLL.

          Comment


          • #15
            Originally posted by edgmnt View Post
            I'm still thinking io_uring is closer. We essentially want batched syscall submission and possibly limited in-kernel code execution to cover such cases with a good degree of generality.
            With a conventional open() + read() + close() sequence, you have serial dependencies between each call. Can io_uring do that, and route the file descriptor between them? Otherwise, it's going to be higher-latency, if the file descriptor has to make a round-trip through userspace. Even if it can, it seems to me that error-handling would be more complex, when making a 3-call sequence via io_uring.

            Whether or not you're using io_uring, I think readfile() is worth having.

            Comment


            • #16
              I'm not sure io_uring can do it as it is, but I'm rather suggesting a more generic batch/code execution mechanism. I merely mentioned io_uring because it's a first step in that direction. eBPF is another.

              Comment

              Working...
              X