• Darrick J. Wong's avatar
    xfs: reduce the rate of cond_resched calls inside scrub · 271557de
    Darrick J. Wong authored
    We really don't want to call cond_resched every single time we go
    through a loop in scrub -- there may be billions of records, and probing
    into the scheduler itself has overhead.  Reduce this overhead by only
    calling cond_resched 10x per second; and add a counter so that we only
    check jiffies once every 1000 records or so.
    
    Surprisingly, this reduces scrub-only fstests runtime by about 2%.  I
    used the bmapinflate xfs_db command to produce a billion-extent file and
    this stupid gadget reduced the scrub runtime by about 4%.
    
    From a stupid microbenchmark of calling these things 1 billion times, I
    estimate that cond_resched costs about 5.5ns per call; jiffes costs
    about 0.3ns per read; and fatal_signal_pending costs about 0.4ns per
    call.
    Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    271557de
xfile.c 7.44 KB