Commit Graph
3617 Commits
Author SHA1 Message Date
Alan Cox ca2170c820 MFC r319542,321003,321378
Eliminate duplication of the pmap and pv list unlock operations in
  pmap_enter() by implementing a single return path.  Otherwise, the
  duplication will only increase with the upcoming support for psind == 1.

  Extract the innermost loop of pmap_remove() out into its own function,
  pmap_remove_ptes().  (This new function will also be used by an upcoming
  change to pmap_enter() that adds support for psind == 1 mappings.)

  Add support for pmap_enter(..., psind=1) to the amd64 pmap.  In other words,
  add support for explicitly requesting that pmap_enter() create a 2MB page
  mapping.  (Essentially, this feature allows the machine-independent layer to
  create superpage mappings preemptively, and not wait for automatic promotion
  to occur.)

  Export pmap_ps_enabled() to the machine-independent layer.

  Add a flag to pmap_pv_insert_pde() that specifies whether it should fail or
  reclaim a PV entry when one is not available.

  Refactor pmap_enter_pde() into two functions, one by the same name, that is
  a general-purpose function for creating PDE PG_PS mappings, and another,
  pmap_enter_2mpage(), that is used to prefault 2MB read- and/or execute-only
  mappings for execve(2), mmap(2), and shmat(2).
2017-10-07 18:36:42 +00:00
Alan Cox c695e16572 MFC r320980,321377
Generalize vm_page_ps_is_valid() to support testing other predicates on
  the (super)page, renaming the function to vm_page_ps_test().

  In vm_page_ps_test(), always check that the base pages within the specified
  superpage all belong to the same object.  To date, that check has not been
  needed, but upcoming changes require it.
2017-10-07 18:08:37 +00:00
Alan Cox 0bdef48970 MFC r323973,324087
Optimize vm_page_try_to_free().  Specifically, the call to pmap_remove_all()
  can be avoided when the page's containing object has a reference count of
  zero.  (If the object has a reference count of zero, then none of its pages
  can possibly be mapped.)

  Address nearby style issues in vm_page_try_to_free(), and change its
  return type to "bool".

  Optimize vm_object_page_remove() by eliminating pointless calls to
  pmap_remove_all().  If the object to which a page belongs has no
  references, then that page cannot possibly be mapped.
2017-10-07 17:20:31 +00:00
Konstantin Belousov 1a6fa4bfe3 MFC r323768:
For unlinked files, do not msync(2) or sync on the vnode deactivation.
2017-10-03 11:00:34 +00:00
Alan Cox b1b991b46d MFC r323391
To analyze the allocation of swap blocks by blist functions, add a method
  for analyzing the radix tree structures and reporting on the number, and
  sizes, of maximal intervals of free blocks.  The report includes the number
  of maximal intervals, and also the number of them in each of several size
  ranges, from small (size 1, or 3 to 4) to large (28657 to 46367) with size
  boundaries defined by Fibonacci numbers.  The report is written in the test
  tool with the 's' command, or in a running kernel by sysctl.

  The analysis of the radix tree frequently computes the position of the lone
  bit set in a u_daddr_t, a computation that also appears in leaf allocation.
  That computation has been moved into a function of its own, and optimized
  for cases where an inlined machine instruction can replace the usual binary
  search.
2017-09-30 19:54:30 +00:00
Mark Johnston 13629cdd59 MFC r323613:
Include _bitset.h to get BITSET_DEFINE, used to define struct slabbits.
2017-09-28 15:23:38 +00:00
Mark Johnston 0254e81031 MFC r323290:
Speed up vm_page_array initialization.
2017-09-28 15:21:47 +00:00
Mark Johnston e779271233 MFC r323544:
Fix a logic error in the item size calculation for internal UMA zones.
2017-09-27 14:19:47 +00:00
Mark Johnston 0ae9184ef6 MFC r323564:
Widen uk_pgoff, the slab header offset field.

PR:	218911
2017-09-27 14:18:20 +00:00
Konstantin Belousov 60a5227902 MFC r323616:
Batch freeing of the pages in vm_object_page_remove().
2017-09-22 10:45:51 +00:00
Konstantin Belousov 90db287475 MFC r323562:
Remove inline specifier from vm_page_free_wakeup(), do not
micro-manage compiler.
2017-09-20 09:31:16 +00:00
Konstantin Belousov 3a56156fe1 MFC r323561:
Do not relock free queue mutex for each page, free whole terminating
object' page queue under the single mutex lock.
2017-09-20 09:29:03 +00:00
Konstantin Belousov ba805c55df MFC r322571 (by br):
Add OBJ_PG_DTOR flag to VM object.
2017-09-20 09:22:47 +00:00
Konstantin Belousov cd5ea4264c MFC r321330 (by br):
Style.
2017-09-20 09:17:48 +00:00
Konstantin Belousov ef1ccdd2e0 MFC r323559:
Split vm_page_free_toq().
2017-09-20 09:11:27 +00:00
Konstantin Belousov bc852769c9 MFC r323558:
Use existing tag name for the vm_object' memq.
2017-09-20 08:51:03 +00:00
Mark Johnston 7aa5a17c37 MFC r322405, r322406:
Modify vm_page_grab_pages() to handle VM_ALLOC_NOWAIT, use it in
sendfile_swapin().
2017-09-17 15:45:39 +00:00
Alan Cox 9a80825c48 MFC r322296
Introduce vm_page_grab_pages(), which is intended to replace loops calling
  vm_page_grab() on consecutive page indices.  Besides simplifying the code
  in the caller, vm_page_grab_pages() allows for batching optimizations.
  For example, the current implementation replaces calls to vm_page_lookup()
  on consecutive page indices by cheaper calls to vm_page_next().
2017-09-17 03:17:23 +00:00
Konstantin Belousov 7689e7d602 MFC r323368:
Add a vm_page_change_lock() helper.
2017-09-16 13:49:26 +00:00
Konstantin Belousov 1b0c400587 MFC r322913:
Replace global swhash in swap pager with per-object trie to track swap
blocks assigned to the object pages.

MFC r322970 (by alc):
Do not call vm_pager_page_unswapped() on the fast fault path.

MFC r322971 (by alc):
Update a couple vm_object lock assertions in the swap pager.

MFC r323224:
In swp_pager_meta_build(), handle a race with other thread allocating
swapblk for our index while we dropped the object lock.

MFC r323226:
Do not leak empty swblk.
2017-09-13 11:19:04 +00:00
Konstantin Belousov af641a88c2 MFC r323018:
Adjust interface of swapon_check_swzone() to its actual usage.

PR:	221356
2017-09-06 07:06:58 +00:00
Konstantin Belousov 7461c4b72c MFC r323017:
Make the swap_pager_full variable static.

PR:	221356
2017-09-06 07:04:29 +00:00
Mark Johnston c92b9b2a9d MFC r322987:
Synchronize page laundering with pmap_extract_and_hold().
2017-09-05 13:40:10 +00:00
Mark Johnston 621616c569 MFC r322391:
Micro-optimize kmem_unback().
2017-08-18 20:20:49 +00:00
Mark Johnston 4f1de3937c MFC r322383:
Make vm_page_sunbusy() assert that the page is unlocked.
2017-08-17 17:11:59 +00:00
Konstantin Belousov 71bffcf948 MFC r321581:
Mark pages after EOF as clean after pageout.
2017-08-02 08:07:13 +00:00
Konstantin Belousov ec865348d0 MFC r321371:
Do not allocate struct kinfo_vmobject on stack.
2017-07-29 07:59:28 +00:00
Konstantin Belousov b573bd9318 MFC r321217:
Remove unused function swap_pager_isswapped().
2017-07-26 07:00:27 +00:00
Konstantin Belousov 47f809fd02 MFC r321247:
Add pctrie_init() and vm_radix_init() to initialize generic pctrie and
vm_radix trie.
2017-07-26 06:52:45 +00:00
Alexander Motin fc2d5e6eba Revert unexpected changes leaked into r321411. 2017-07-24 06:07:44 +00:00
Alexander Motin 5622e4851b MFC r302850: Make PCI interupts allocation static when using bootrom (UEFI).
This makes factual interrupt routing match one shipped with UEFI firmware.
With old firmware this make legacy interrupts work reliable for functions 0
of PCI slots 3-6.  Updated UEFI image fixes problem completely.
2017-07-24 05:52:10 +00:00
Alan Cox 718e5ba370 MFC r320319
Increase the pageout cluster size to 32 pages.

  Decouple the pageout cluster size from the size of the hash table entry
  used by the swap pager for mapping (object, pindex) to a block on the
  swap device(s), and keep the size of a hash table entry at its current
  size.

  Eliminate a pointless macro.
2017-07-22 16:58:47 +00:00
Alan Cox e57914ca24 MFC r320498
Clear the MAP_WIREFUTURE flag on the vm map in exec_new_vmspace() when it
  recycles the current vm space.  Otherwise, an mlockall(MCL_FUTURE) could
  still be in effect on the process after an execve(2), which violates the
  specification for mlockall(2).

  It's pointless for vm_map_stack() to check the MEMLOCK limit.  It will
  never be asked to wire the stack.  Moreover, it doesn't even implement
  wiring of the stack.
2017-07-22 04:20:08 +00:00
Konstantin Belousov 8ab87bb8ed MFC r321173:
Convert assertion that only vmspace owner grows the stack, into a
check blocking grow from other processes accesses.

MFC r321230:
Disable stack growth when accessed by AIO daemons.
2017-07-21 06:52:40 +00:00
Konstantin Belousov 5d22b53c6a MFC r320843:
Fix loop termination in vm_map_find_min().
2017-07-12 06:49:32 +00:00
Konstantin Belousov e67314a5ef Restore layout of struct vm_map_entry, to restore layout of struct
vm_map which embeds vm_map_entries.

This is a direct commit to stable/11.

Diagnosed by:	markj
Sponsored by:	The FreeBSD Foundation
2017-07-11 05:46:55 +00:00
Mark Johnston b7a1e3158e MFC r311346, r311352, r313756:
Add an allocator for KVA for execve arguments.
2017-07-08 01:56:48 +00:00
Mark Johnston 7f82830433 MFC r312208, r312994:
Optimize vm_object_madvise().
2017-07-07 16:59:14 +00:00
Konstantin Belousov 2110f0a42c Add MAP_GUARD and use it for stack grow area protection.
Bump __FreeBSD_version.

MFC r320317:
Implement address space guards.

MFC r320338:
Remove stale part of the comment.

MFC r320339:
Correctly handle small MAP_STACK requests.

MFC r320344:
For now, allow mprotect(2) over the guards to succeed regardless of
the requested protection.

MFC r320430:
Treat the addr argument for mmap(2) request without MAP_FIXED flag as
a hint.

MFC r320560 (by alc):
Modify vm_map_growstack() to protect itself from the possibility of the
gap entry in the vm map being smaller than the sysctl-derived stack guard
size.
2017-07-05 06:18:00 +00:00
Mark Johnston 78d1a34e00 MFC r303052:
Make vm_pageout_wakeup_thresh a u_int rather than an int.
2017-07-03 18:42:26 +00:00
Mark Johnston 6e996e25ab MFC r309017 (partially):
Omit v_cache_count when computing the number of free pages, since its
value is always 0.
2017-07-03 16:40:05 +00:00
Konstantin Belousov 15d9d39313 MFC r320332:
Style.
2017-07-02 03:47:56 +00:00
Alan Cox 4f0cab562d MFC r320049
Pages that are passed to swap_pager_putpages() should already be fully
  dirty.  Assert that they are fully dirty rather than redundantly calling
  vm_page_dirty() on them.
2017-07-01 21:54:11 +00:00
Alan Cox c5eb082729 MFC r320181
Eliminate an unused macro.
2017-07-01 19:47:13 +00:00
Alan Cox 01fa86534f MFC r319605
The variable "breakout" is used like a Boolean, so actually define it as
  one.
2017-07-01 19:06:14 +00:00
Konstantin Belousov c34b518112 MFC r320316:
Do not try to unmark MAP_ENTRY_IN_TRANSITION marked by other thread.
2017-07-01 03:33:26 +00:00
Konstantin Belousov 17a2b9828d MFC r320202:
Call pmap_copy() only for map entries which have the backing object
instantiated.

Approved by:	re (delphij)
2017-06-28 05:20:28 +00:00
Konstantin Belousov 38ffa212df MFC r320201:
Assert that the protection of a new map entry is a subset of the max
protection.

Approved by:	re (delphij)
2017-06-28 04:25:20 +00:00
Konstantin Belousov ea64483763 MFC r320121:
Ignore the P_SYSTEM process flag, and do not request
VM_MAP_WIRE_SYSTEM mode when wiring the newly grown stack.

Approved by:	re (marius)
2017-06-26 12:37:11 +00:00
Konstantin Belousov e92611d204 MFC r319975:
Some minor improvements to vnode_pager_generic_putpages().

Approved by:	re (marius)
2017-06-22 11:03:42 +00:00