Announcement

Collapse
No announcement yet.

Linux 6.8 Landing A Tantalizing Optimization For Common $PATH-Based Searches

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

  • Linux 6.8 Landing A Tantalizing Optimization For Common $PATH-Based Searches

    Phoronix: Linux 6.8 Landing A Tantalizing Optimization For Common $PATH-Based Searches

    For the execve() system call to execute a program by pathname, the Linux 6.8 kernel is set to land a new optimization to "dramatically" speed-up PATH searches...

    Phoronix, Linux Hardware Reviews, Linux hardware benchmarks, Linux server benchmarks, Linux benchmarking, Desktop Linux, Linux performance, Open Source graphics, Linux How To, Ubuntu benchmarks, Ubuntu hardware, Phoronix Test Suite

  • #2
    Didn't nfs mounts behave differently with execve() under some specific conditions?

    Comment


    • #3
      likes of Musl libc, Python, Perl, and others tend to use the execve-based approach
      Should probably be execvpe-based.

      NodeJS uses execvpe too.
      Anyway, it's a nice optimization.

      Comment


      • #4
        execvpe(3) is a library routine (as are the other exec*p* routine I believe) so I always assumed those routines stat(2)ed each candidate progname along the PATH and moved on if ENOENT etc or possibly the relevant permissions (r-x) bits were not set. Only where the file existed and had the correct perms that execve(2) would be attempted but of course could fail if the wrong format or architecture or missing interpreter etc.
        Unless there are cases where execv(2) is possible but stat(2) is not I would have thought execvpe(3) wouldn't often call execve(2) all that frequently in practice.
        Still a nice optimisation that would reduce the impact in the system of malicious storm of failing execs etc.

        Comment


        • #5
          funny thing is that search path for executables is shrinking as there's no more /sbin /bin /usr/sbin /usr/X11/bin. On the other hand, anyone using cli python tools knows that searching PYTHONPATH is quite time consuming for simple scripts with that have a bunch of package dependencies.
          Last edited by fitzie; 09 January 2024, 03:22 AM.

          Comment


          • #6
            Oh but the code is bad quality because it contains use of goto. Should've rewritten the whole thing in Rust instead!

            Comment


            • #7
              Originally posted by toves View Post
              execvpe(3) is a library routine (as are the other exec*p* routine I believe) so I always assumed those routines stat(2)ed each candidate progname along the PATH and moved on if ENOENT etc or possibly the relevant permissions (r-x) bits were not set. Only where the file existed and had the correct perms that execve(2) would be attempted but of course could fail if the wrong format or architecture or missing interpreter etc.
              Unless there are cases where execv(2) is possible but stat(2) is not I would have thought execvpe(3) wouldn't often call execve(2) all that frequently in practice.
              I don't know if this is reasonably possible in practice (of course you can write a seccomp-bpf filter that blocks stat while letting through execve), but one problem with that approach is that the file you have determined to exist using stat may be gone until you come around to the exec.

              Comment


              • #8
                Originally posted by curfew View Post
                Oh but the code is bad quality because it contains use of goto. Should've rewritten the whole thing in Rust instead!
                Rust needs to goto offline;

                Comment


                • #9
                  Another great optimization:



                  Analyze and reorganize core networking structs (socks, netdev, netns, mibs) to optimize cacheline consumption and set up build time warnings to safeguard against future header changes. This improves TCP performances with many concurrent connections up to 40%.​
                  Linux 6.8 is going to be in great shape.

                  Comment

                  Working...
                  X