• Jan Kara's avatar
    fs/sync.c: make sync_file_range(2) use WB_SYNC_NONE writeback · 23d01270
    Jan Kara authored
    sync_file_range(2) is documented to issue writeback only for pages that
    are not currently being written.  After all the system call has been
    created for userspace to be able to issue background writeout and so
    waiting for in-flight IO is undesirable there.  However commit
    ee53a891 ("mm: do_sync_mapping_range integrity fix") switched
    do_sync_mapping_range() and thus sync_file_range() to issue writeback in
    WB_SYNC_ALL mode since do_sync_mapping_range() was used by other code
    relying on WB_SYNC_ALL semantics.
    These days do_sync_mapping_range() went away and we can switch
    sync_file_range(2) back to issuing WB_SYNC_NONE writeback.  That should
    help PostgreSQL avoid large latency spikes when flushing data in the
    Andres measured a 20% increase in transactions per second on an SSD disk.
    Signed-off-by: default avatarJan Kara <jack@suse.com>
    Reported-by: default avatarAndres Freund <andres@anarazel.de>
    Tested-By: default avatarAndres Freund <andres@anarazel.de>
    Cc: Al Viro <viro@ZenIV.linux.org.uk>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
sync.c 9.92 KB