freebsd-skq/sys/contrib
markj ccbfa8304f Change synchonization rules for vm_page reference counting.
There are several mechanisms by which a vm_page reference is held,
preventing the page from being freed back to the page allocator.  In
particular, holding the page's object lock is sufficient to prevent the
page from being freed; holding the busy lock or a wiring is sufficent as
well.  These references are protected by the page lock, which must
therefore be acquired for many per-page operations.  This results in
false sharing since the page locks are external to the vm_page
structures themselves and each lock protects multiple structures.

Transition to using an atomically updated per-page reference counter.
The object's reference is counted using a flag bit in the counter.  A
second flag bit is used to atomically block new references via
pmap_extract_and_hold() while removing managed mappings of a page.
Thus, the reference count of a page is guaranteed not to increase if the
page is unbusied, unmapped, and the object's write lock is held.  As
a consequence of this, the page lock no longer protects a page's
identity; operations which move pages between objects are now
synchronized solely by the objects' locks.

The vm_page_wire() and vm_page_unwire() KPIs are changed.  The former
requires that either the object lock or the busy lock is held.  The
latter no longer has a return value and may free the page if it releases
the last reference to that page.  vm_page_unwire_noq() behaves the same
as before; the caller is responsible for checking its return value and
freeing or enqueuing the page as appropriate.  vm_page_wire_mapped() is
introduced for use in pmap_extract_and_hold().  It fails if the page is
concurrently being unmapped, typically triggering a fallback to the
fault handler.  vm_page_wire() no longer requires the page lock and
vm_page_unwire() now internally acquires the page lock when releasing
the last wiring of a page (since the page lock still protects a page's
queue state).  In particular, synchronization details are no longer
leaked into the caller.

The change excises the page lock from several frequently executed code
paths.  In particular, vm_object_terminate() no longer bounces between
page locks as it releases an object's pages, and direct I/O and
sendfile(SF_NOCACHE) completions no longer require the page lock.  In
these latter cases we now get linear scalability in the common scenario
where different threads are operating on different files.

__FreeBSD_version is bumped.  The DRM ports have been updated to
accomodate the KPI changes.

Reviewed by:	jeff (earlier version)
Tested by:	gallatin (earlier version), pho
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D20486
2019-09-09 21:32:42 +00:00
..
alpine-hal
ck Import CK as of 21d3e319407d19dece16ee317c757ffc54a452bc, which makes its 2018-11-27 12:35:51 +00:00
cloudabi Import the latest CloudABI definitions, v0.18. 2017-11-21 20:46:21 +00:00
dev athhal: disable unused function (big endian only) 2019-08-21 10:42:31 +00:00
edk2
ena-com Adjust ENA driver to the new ena-com 2019-05-30 13:01:46 +00:00
ipfilter/netinet Document ipf_nat_hashtab_add() return codes. 2019-08-28 04:55:17 +00:00
libb2 MFV: libb2: use native calls for secure memory clearance 2018-03-27 14:55:01 +00:00
libfdt MFV r328490: Update libfdt to github:f1879e1 2018-01-27 21:25:45 +00:00
libnv The nvlist_report_missing is also used by the cnvlist. 2019-04-11 04:24:41 +00:00
libsodium Bring in libsodium to sys/contrib 2018-08-17 00:23:50 +00:00
ncsw dpaa: Fix warnings in dtsec(4) found by clang 2019-08-21 02:26:22 +00:00
ngatm
octeon-sdk Octeon SDK: avoid use of uninitialized variable 2018-11-09 19:17:25 +00:00
rdma/krping krping: Fix for memory leak in error case. 2018-12-05 13:27:48 +00:00
v4l
vchiq/interface Change synchonization rules for vm_page reference counting. 2019-09-09 21:32:42 +00:00
x86emu
xz-embedded Modularize xz. 2019-02-26 19:55:03 +00:00
zlib MFV r351500: Fix CLEAR_HASH macro to be usable as a single statement. 2019-08-26 00:46:39 +00:00
zstd Stopgap fix for gcc platforms. 2019-08-08 20:09:36 +00:00