opnsense-src/sys/compat/linuxkpi/common/include/linux
Mark Johnston fee2a2fa39 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
..
atomic.h LinuxKPI: Include asm/atomic-long.h from atomic.h. 2019-05-15 17:44:25 +00:00
bitmap.h Implement bitmap_complement() in the LinuxKPI. 2018-05-31 12:48:24 +00:00
bitops.h Implement BITS_PER_TYPE() function macro in the LinuxKPI. 2019-03-13 17:55:58 +00:00
bottom_half.h Add support for LinuxKPI tasklets. 2017-02-21 13:23:53 +00:00
cache.h
cdev.h linuxkpi: Remove extraneous NULL check on M_WAITOK allocation 2019-01-01 19:56:49 +00:00
clocksource.h Remove cycle_t type from the LinuxKPI similar to Linux upstream. 2017-07-31 09:17:54 +00:00
compat.h lkpi: allow late binding of linux_alloc_current 2019-02-22 23:15:32 +00:00
compiler.h LinuxKPI: Move {lower|upper}_32_bits macros from port to base. 2019-05-15 17:48:11 +00:00
completion.h Correct macroname in the LinuxKPI. 2018-05-31 12:55:38 +00:00
dcache.h Refactor dentry structure into its own header file in the LinuxKPI similary 2018-02-18 08:29:25 +00:00
debugfs.h import linux debugfs support 2019-02-23 20:56:41 +00:00
delay.h Use mstosbt() instead of SBT_1MS in the LinuxKPI to get the last few bits 2018-03-03 19:26:40 +00:00
device.h LinuxKPI: Improve sysfs support. 2019-09-06 15:43:53 +00:00
dma-attrs.h Properly define the DMA attribute values in the LinuxKPI. 2019-03-13 17:51:08 +00:00
dma-mapping.h LinuxKPI should use bus_dma(9) to be compatible with an IOMMU 2019-04-24 20:30:45 +00:00
dmapool.h Make the dma_pool structure private to the LinuxKPI similar to Linux. 2019-04-30 09:38:22 +00:00
err.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
errno.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
etherdevice.h Replace read_random(9) with more appropriate arc4rand(9) KPIs 2019-04-04 01:02:50 +00:00
export.h Move the EXPORT_SYMBOL_XXX() function macros into own header file. 2018-06-07 11:34:59 +00:00
file.h Eliminate the overhead of gratuitous repeated reinitialization of cap_rights 2018-05-09 18:47:24 +00:00
fs.h linux/fs: simplify interop and correct definition of loff_t 2019-02-23 20:45:45 +00:00
gfp.h Add necessary bits for Linux KPI to work correctly on powerpc 2019-08-04 19:28:10 +00:00
hardirq.h
hrtimer.h Improve high resolution timer support in the LinuxKPI. 2018-06-01 11:33:14 +00:00
idr.h Resolve duplicate symbol name conflict after r345095, when building LINT. 2019-03-13 19:53:20 +00:00
if_arp.h
if_ether.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
if_vlan.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
in.h Add support for more IPv4 and IPv6 related macros in the LinuxKPI. 2017-03-22 15:44:00 +00:00
in6.h Unconditionally include "opt_inet6.h" in the LinuxKPI. 2017-11-01 12:21:28 +00:00
inetdevice.h Mechanical cleanup of epoch(9) usage in network stack. 2019-01-09 01:11:19 +00:00
interrupt.h Implement pci_enable_msi() and pci_disable_msi() in the LinuxKPI. 2019-08-14 09:36:25 +00:00
io-mapping.h Let io_mapping_init_wc() fall back to an uncacheable mapping. 2017-07-03 02:01:16 +00:00
io.h Use DEVICE memory instead of UNCACHEABLE on aarch64 in ioremap() in the LinuxKPI. 2019-09-02 08:34:45 +00:00
ioctl.h Define _IOC_SIZE() in the LinuxKPI. 2016-05-13 11:42:36 +00:00
irqreturn.h Move the IRQ_RETVAL() and irqreturn definitions to irqreturn.h in the 2018-02-17 20:37:21 +00:00
jhash.h
jiffies.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
kdev_t.h Fix LinuxKPI regression after r321920. The mda_unit and si_drv0 fields are not 2017-08-02 14:27:27 +00:00
kernel.h LinuxKPI: Add helper macros IS_ALIGNED and DIV_ROUND_DOWN_ULL. 2019-05-15 17:57:06 +00:00
kmod.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
kobject.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
kref.h Add support for kref_read() function in the LinuxKPI. 2018-02-17 20:56:35 +00:00
kthread.h Add kthread parking support to the LinuxKPI. 2017-06-18 19:22:05 +00:00
ktime.h LinuxKPI: Expand ktime functionality. 2019-05-15 16:59:04 +00:00
list.h Implement list_for_each_entry_from_reverse() and 2019-03-13 18:47:17 +00:00
lockdep.h Fix build with DRM and INVARIANTS enabled. 2019-08-13 21:15:59 +00:00
log2.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
math64.h Implement mul_u32_u32() function in the LinuxKPI. 2018-06-05 15:30:36 +00:00
miscdevice.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
mm.h Change synchonization rules for vm_page reference counting. 2019-09-09 21:32:42 +00:00
mm_types.h LinuxKPI: Add vm_fault_t type. 2019-05-14 23:32:02 +00:00
module.h Move the EXPORT_SYMBOL_XXX() function macros into own header file. 2018-06-07 11:34:59 +00:00
moduleparam.h Stub kernel_param_lock() and kernel_param_unlock() in the LinuxKPI. 2018-03-04 19:10:30 +00:00
mutex.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
net.h
net_dim.h Add support for Dynamic Interrupt Moderation, DIM, in mlx5en(4). 2019-05-08 10:23:33 +00:00
netdevice.h linuxkpi: properly implement netif_carrier_ok(). 2018-12-05 13:17:15 +00:00
notifier.h Add definition for the NETDEV_CHANGE event and tidy up the LinuxKPI 2016-01-26 14:27:00 +00:00
page.h Make sure the "vm_flags" and "vm_page_prot" fields get set correctly 2017-08-11 10:44:40 +00:00
pci.h Implement pci_enable_msi() and pci_disable_msi() in the LinuxKPI. 2019-08-14 09:36:25 +00:00
pfn.h Implement a series of physical page management related functions in 2017-03-27 17:04:11 +00:00
pfn_t.h Implement a series of physical page management related functions in 2017-03-27 17:04:11 +00:00
pid.h Implement get_task_pid() function macro in the LinuxKPI. 2018-02-17 22:33:26 +00:00
poll.h Properly implement poll_wait() in the LinuxKPI. This prevents direct 2017-09-09 06:29:29 +00:00
preempt.h LinuxKPI: Add in_task macro. 2019-05-16 21:07:37 +00:00
printk.h Implement print_hex_dump_debug() function macro in the LinuxKPI. 2019-05-06 16:10:26 +00:00
radix-tree.h Implement radix_tree_iter_delete() in the LinuxKPI. 2018-06-01 11:42:09 +00:00
random.h LinuxKPI: Add get_random_u32 function. 2019-05-15 17:32:00 +00:00
rbtree.h
rculist.h LinuxKPI: Additions to rcu list. 2019-06-21 18:48:07 +00:00
rcupdate.h Define some RCU debug macros in the LinuxKPI. 2019-03-13 19:24:30 +00:00
rwlock.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
rwsem.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
scatterlist.h Fix regression issue after r346645 in the LinuxKPI. 2019-05-04 09:47:01 +00:00
sched.h LinuxKPI: Add group_leader member to struct task_struct. 2019-05-16 17:53:36 +00:00
semaphore.h Make the LinuxKPI task struct persistent accross system calls. 2017-02-21 12:43:02 +00:00
seq_file.h LinuxKPI: Finalize import of seq_file. 2019-05-16 21:17:18 +00:00
slab.h Implement more malloc function macros in the LinuxKPI. 2019-03-13 19:17:52 +00:00
smp.h Add on_each_cpu() and wbinvd_on_all_cpus(). 2017-05-01 16:32:28 +00:00
socket.h
spinlock.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
srcu.h Implement DEFINE_STATIC_SRCU() function macro in the LinuxKPI. 2019-03-13 18:00:25 +00:00
string.h Implement memdup_user_nul() in the LinuxKPI. 2018-02-16 15:52:28 +00:00
swap.h linuxkpi: Use pageproc instead of vmproc 2018-11-21 04:34:18 +00:00
sysfs.h LinuxKPI: Improve sysfs support. 2019-09-06 15:43:53 +00:00
time.h Make timespecadd(3) and friends public 2018-07-30 15:46:40 +00:00
timer.h LinuxKPI: Let del_timer return a value to match Linux. 2019-05-14 23:12:14 +00:00
types.h Add ushort and ulong to linux/types.h. 2019-03-01 14:33:20 +00:00
uaccess.h LinuxKPI: Update access_ok macro for v5.0. 2019-05-16 17:44:17 +00:00
usb.h linuxkpi whitespace cleanup 2018-03-23 15:50:01 +00:00
vmalloc.h
wait.h Implement the __add_wait_queue_entry_tail() function in the LinuxKPI. 2018-06-06 15:19:30 +00:00
workqueue.h Linuxkpi: Prevent easy generated ctor name conflicts with prefix 2019-08-17 03:00:58 +00:00
ww_mutex.h LinuxKPI: Add context member to ww_mutex and bump FreeBSD version. 2019-05-14 23:21:20 +00:00