• Steve Fink's avatar
    ss -p is much too slow · fbc0f876
    Steve Fink authored
    > On closer inspection, it appears that ss -p does a quadratic scan. It
    > rescans every entry in /proc/*/fd/* repeatedly (once per listening
    > port? per process? I don't remember what I figured out.)
    >
    > I humbly suggest that this is not a good idea.
    
    Yep, this is junk.  Please give this patch a try:
    
    ss: Avoid quadradic complexity with '-p'
    
    Scan the process list of open sockets once, and store in a hash
    table to be used by subsequent find_user() calls.
    Reported-by: default avatarSteve Fink <sphink@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    fbc0f876
ss.c 61.2 KB