• Hugh Dickins's avatar
    [PATCH] tmpfs truncate latency · 0c751b9b
    Hugh Dickins authored
    High latency observed when deleting a large video file from tmpfs.
    
    shmem_truncate held info->lock (easily dropped) and nested atomic kmaps
    (more awkward to handle, since it's structured to keep them) while scanning
    the many pages of its swap vector.  Now be prepared to cond_resched every
    64 ops (but scan an empty page in one go).
    
    shmem_free_pages to free a linked list of empty swap vector pages at the
    end (cond_resched every 64): could still free them one by one in the main
    loop, but this foreshadows scalability changes - which will want to use RCU
    on them, only freeing the pages after a grace period.
    Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    0c751b9b
shmem.c 57.1 KB