As a step towards the elimination of PG_CACHED pages, rework the handling
authormarkj <markj@FreeBSD.org>
Wed, 30 Sep 2015 23:06:29 +0000 (23:06 +0000)
committermarkj <markj@FreeBSD.org>
Wed, 30 Sep 2015 23:06:29 +0000 (23:06 +0000)
commit6348241c12da94254c6b2797b8b3cedaf6642db1
tree1e2b61f35c22941061c31586e1d027222bdcbb8a
parentaca221db9d8ee973f5ca86a03adfddf468891409
As a step towards the elimination of PG_CACHED pages, rework the handling
of POSIX_FADV_DONTNEED so that it causes the backing pages to be moved to
the head of the inactive queue instead of being cached.

This affects the implementation of POSIX_FADV_NOREUSE as well, since it
works by applying POSIX_FADV_DONTNEED to file ranges after they have been
read or written.  At that point the corresponding buffers may still be
dirty, so the previous implementation would coalesce successive ranges and
apply POSIX_FADV_DONTNEED to the result, ensuring that pages backing the
dirty buffers would eventually be cached.  To preserve this behaviour in an
efficient manner, this change adds a new buf flag, B_NOREUSE, which causes
the pages backing a VMIO buf to be placed at the head of the inactive queue
when the buf is released.  POSIX_FADV_NOREUSE then works by setting this
flag in bufs that underlie the specified range.

Reviewed by: alc, kib
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D3726
sys/kern/vfs_bio.c
sys/kern/vfs_default.c
sys/kern/vfs_syscalls.c
sys/kern/vfs_vnops.c
sys/sys/buf.h
sys/sys/file.h
sys/vm/vm_object.c
sys/vm/vm_object.h
sys/vm/vm_page.c
sys/vm/vm_page.h