git: kernel - Slightly change the behavior of MADV_NOSYNC and MAP_NOSYNC

Matthew Dillon dillon at crater.dragonflybsd.org
Wed Feb 27 21:52:11 PST 2019


commit 01516960d64ea6f08a89bef25a3f0fd4fe41b552
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Wed Feb 27 21:42:25 2019 -0800

    kernel - Slightly change the behavior of MADV_NOSYNC and MAP_NOSYNC
    
    * When files pages are mapped with the NOSYNC flag, the user program
      is requesting that the kernel not periodically flush the dirty pages
      to the filesystem under normal operation.  Such pages can still be
      flushed due to memory pressure.
    
    * However, if the pages are not set back to MADV_AUTOSYNC, this behavior
      can persist indefinitely (until umount or vnode recyclement), even
      after all the related processes have closed/unmapped the file.  This
      results in very non-deterministic (and likely unexpected) flush behavior.
    
    * Change the behavior to flush such dirty pages during the normal periodic
      filesystem sync if the file is found to no longer be mapped and also
      no longer open for writing.  If the program wants to throw the data away
      permanently, the program should delete or truncate the file.
    
      In otherwords, the requested NOSYNC behavior is only applicable when the
      file is open for writing or memory mapped.

Summary of changes:
 sys/kern/vfs_subr.c | 42 ++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 40 insertions(+), 2 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/01516960d64ea6f08a89bef25a3f0fd4fe41b552


-- 
DragonFly BSD source repository



More information about the Commits mailing list