• Rik Van Riel's avatar
    [PATCH] swaptoken tuning · fcdae29a
    Rik Van Riel authored
    It turns out that the original swap token implementation, by Song Jiang, only
    enforced the swap token while the task holding the token is handling a page
    fault.  This patch approximates that, without adding an additional flag to the
    mm_struct, by checking whether the mm->mmap_sem is held for reading, like the
    page fault code does.
    
    This patch has the effect of automatically, and gradually, disabling the
    enforcement of the swap token when there is little or no paging going on, and
    "turning up" the intensity of the swap token code the more the task holding
    the token is thrashing.
    
    Thanks to Song Jiang for pointing out this aspect of the token based thrashing
    control concept.
    
    The new code shows a slight degradation over the old swap token code, but
    still a big win over running without the swap token.
    
    2.6.12+ swap token disabled
    
    $ for i in `seq 10` ; do /usr/bin/time ./qsbench -n 30000000 -p 3 ; done
    101.74user 23.13system 8:26.91elapsed 24%CPU (0avgtext+0avgdata 0maxresident)k
    0in...
    fcdae29a
rmap.c 21.7 KB