• Corrado Zoccolo's avatar
    cfq-iosched: rework seeky detection · 3dde36dd
    Corrado Zoccolo authored
    Current seeky detection is based on average seek lenght.
    This is suboptimal, since the average will not distinguish between:
    * a process doing medium sized seeks
    * a process doing some sequential requests interleaved with larger seeks
    and even a medium seek can take lot of time, if the requested sector
    happens to be behind the disk head in the rotation (50% probability).
    
    Therefore, we change the seeky queue detection to work as follows:
    * each request can be classified as sequential if it is very close to
      the current head position, i.e. it is likely in the disk cache (disks
      usually read more data than requested, and put it in cache for
      subsequent reads). Otherwise, the request is classified as seeky.
    * an history window of the last 32 requests is kept, storing the
      classification result.
    * A queue is marked as seeky if more than 1/8 of the last 32 requests
      were seeky.
    
    This patch fixes a regression reported by Yanmin, on mmap 64k random
    reads.
    Reported-by: default avatarYanmin Zhang <yanmin_zhang@linux.intel.com>
    Signed-off-by: default avatarCorrado Zoccolo <czoccolo@gmail.com>
    Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
    3dde36dd
cfq-iosched.c 97 KB