• Robert Love's avatar
    [PATCH] O(1) count_active_tasks · 01bc15ed
    Robert Love authored
    This is William Irwin's algorithmically O(1) version of
    count_active_tasks (which is currently O(n) for n total tasks on the
    system).
    
    I like it a lot: we become O(1) because now we count uninterruptible
    tasks, so we can return (nr_uninterruptible + nr_running).  It does not
    introduce any overhead or hurt the case for small n, so I have no
    complaints.
    
    This copy has a small optimization over the original posting, but is
    otherwise the same thing wli posted earlier.  I have tested to make sure
    this returns accurate results and that the kernel profile improves.
    01bc15ed
timer.c 22.7 KB