• Andi Kleen's avatar
    [PATCH] poll/select fast path · 30724dcd
    Andi Kleen authored
    This patch streamlines poll and select by adding fast paths for a
    small number of descriptors passed. The majority of polls/selects
    seem to be of this nature. The main saving comes from not allocating
    two pages for wait queue and table, but from using stack allocation
    (upto 256bytes) when only a few descriptors are needed. This makes
    it as fast again as 2.0 and even a bit faster because the wait queue
    page allocation is avoided too (except when the drivers overflow it)
    
    select also skips a lot faster over big holes and avoids the separate
    pass of determining the max. number of descriptors in the bitmap.
    
    A typical linux system saves a considerable amount of unswappable memory
    with this patch, because it usually has 10+ daemons hanging around in poll or
    select with each two pages allocated for data and wait queue.
    
    Some other cleanups.
    30724dcd
select.c 12.4 KB