git: tmpfs - Improve write clustering

Matthew Dillon dillon at
Wed Feb 12 17:14:34 PST 2020

commit 4eb0bb82efc8ef32c4357cf812891c08d38d8860
Author: Matthew Dillon <dillon at>
Date:   Wed Feb 12 16:41:01 2020 -0800

    tmpfs - Improve write clustering
    * Setup bmap and max iosize parameters so the kernel's clustering
      code can actually cluster 16KB tmpfs blocks together into 64KB
    * In low-memory situations the pageout daemon will flush tmpfs
      pages via the VM page queues.  This ultimately runs through
      the tmpfs_vop_write() UIO_NOCOPY path which was previously using
      cluster_awrite().  However, because other nearby buffers are
      probably not present (buwrite()'s can allow buffers to be
      dismissed early), there is nothing for cluster_awrite() to
      latch onto to improve write granularity beyond 16KB.
      Go back to using cluster_write() when SYNC and DIRECT are not
      specified.  This allows the clustering code to collect buffers
      and flush them in larger chunks.
    * Reduces low-memory tmpfs paging I/O overheads by 4x and
      generally increases paging throughput to SSD-based swap by
      2x-4x.  Tmpfs is now able to issue a lot more 64KB I/Os when under
      memory pressure.

Summary of changes:
 sys/vfs/tmpfs/tmpfs_vfsops.c |  1 +
 sys/vfs/tmpfs/tmpfs_vnops.c  | 39 ++++++++++++++++++++++++++++++++-------
 2 files changed, 33 insertions(+), 7 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list