3424 Commits

Author SHA1 Message Date
smh
227e064147 MFC r270759:
Refactor ZFS ARC reclaim logic to be more VM cooperative

MFC r270861:
Ensure that ZFS ARC free memory checks include cached pages

MFC r272483:
Refactor ZFS ARC reclaim checks and limits

Sponsored by:	Multiplay
2014-10-10 00:12:16 +00:00
bryanv
69c5e8194e MFC 272550:
Remove stray uma_mtx lock/unlock in zone_drain_wait()

  Callers of zone_drain_wait(M_WAITOK) do not need to hold (and were not)
  the uma_mtx, but we would attempt to unlock and relock the mutex if we
  had to sleep because the zone was already draining. The M_NOWAIT callers
  may hold the uma_mtx, but we do not sleep in that case.
2014-10-08 04:07:07 +00:00
alc
2d2ce84b0c MFC r271351
Fix a boundary case error in vm_reserv_alloc_contig().
2014-10-04 22:52:21 +00:00
smh
881bf9eca2 MFC r272071:
Fix ticks wrap issue of lowmem test in vm_pageout_scan

Approved by:	re (kib)
Sponsored by:	Multiplay
2014-09-27 18:20:45 +00:00
kib
6a9b8ab035 MFC r272036:
Avoid calling vm_map_pmap_enter() for the MADV_WILLNEED on the wired
entry, the pages must be already mapped.

Approved by:	re (gjb)
2014-09-27 07:54:27 +00:00
kib
0d20ed9aa7 MFC r271586:
Fix mis-spelling of bits and types names in the vnode_pager_putpages().

Approved by:	re (delphij)
2014-09-21 09:09:37 +00:00
alc
f97e8c2642 This is a direct commit to account for the renaming of 'cnt' to 'vm_cnt'
in HEAD but not stable/10.
2014-09-03 07:20:09 +00:00
alc
3295e3612e MFC r270666
Back in the days when the kernel was single threaded, testing
  "vm_paging_target() > 0" was a reasonable way of determining if the
  inactive queue scan met its target.  However, now that other threads
  can be allocating pages while the inactive queue scan is running, it's
  an unreliable method.  The effect of it being unreliable is that we
  can start swapping out processes when we didn't intend to.

  This issue has existed since the kernel was multithreaded, but the
  changes to the inactive queue target in 10.0-RELEASE have made its
  effects visible.

  This change introduces a more direct method for determining if the
  inactive queue scan met its target that is not affected by the actions
  of other threads.
2014-09-03 06:47:05 +00:00
kib
798eea1614 Fix a leak of the wired pages when unwiring of the PROT_NONE-mapped
wired region.  Rework the handling of unwire to do the it in batch,
both at pmap and object level.

All commits below are by alc.

MFC r268327:
Introduce pmap_unwire().

MFC r268591:
Implement pmap_unwire() for powerpc.

MFC r268776:
Implement pmap_unwire() for arm.

MFC r268806:
pmap_unwire(9) man page.

MFC r269134:
When unwiring a region of an address space, do not assume that the
underlying physical pages are mapped by the pmap.  This fixes a leak
of the wired pages on the unwiring of the region mapped with no access
allowed.

MFC r269339:
In the implementation of the new function pmap_unwire(), the call to
MOEA64_PVO_TO_PTE() must be performed before any changes are made to the
PVO. Otherwise, MOEA64_PVO_TO_PTE() will panic.

MFC r269365:
Correct a long-standing problem in moea{,64}_pvo_enter() that was revealed
by the combination of r268591 and r269134: When we attempt to add the
wired attribute to an existing mapping, moea{,64}_pvo_enter() do nothing.
(They only set the wired attribute on newly created mappings.)

MFC r269433:
Handle wiring failures in vm_map_wire() with the new functions
pmap_unwire() and vm_object_unwire().
Retire vm_fault_{un,}wire(), since they are no longer used.

MFC r269438:
Rewrite a loop in vm_map_wire() so that gcc doesn't think that the variable
"rv" is uninitialized.

MFC r269485:
Retire pmap_change_wiring().

Reviewed by:	alc
2014-09-01 07:58:15 +00:00
kib
4e198665c5 MFC r270011:
Implement 'fast path' for the vm page fault handler.

MFC r270387 (by alc):
Relax one of the conditions for mapping a page on the fast path.

Approved by:	re (gjb)
2014-08-25 21:21:29 +00:00
kib
35c4352f4c MFC r261647 (by alc):
Don't call vm_fault_prefault() on zero-fill faults.
2014-08-25 21:19:08 +00:00
kib
9824920980 MFC r261412 (by alc):
Make prefaulting more aggressive on hard faults.
2014-08-25 21:16:57 +00:00
kib
511f9b7525 MFC r269978 (by alc):
Avoid pointless (but harmless) actions on unmanaged pages.
2014-08-25 20:49:25 +00:00
kib
4fe668ee1a MFC r269746:
Adapt vm_page_aflag_set(PGA_WRITEABLE) to the locking of
pmap_enter(PMAP_ENTER_NOSLEEP).
2014-08-24 07:57:50 +00:00
kib
25782a7fab Merge the changes to pmap_enter(9) for sleep-less operation (requested
by flag).  The ia64 pmap.c changes are direct commit, since ia64 is
removed on head.

MFC r269368 (by alc):
Retire PVO_EXECUTABLE.

MFC r269728:
Change pmap_enter(9) interface to take flags parameter and superpage
mapping size (currently unused).

MFC r269759 (by alc):
Update the text of a KASSERT() to reflect the changes in r269728.

MFC r269822 (by alc):
Change {_,}pmap_allocpte() so that they look for the flag
PMAP_ENTER_NOSLEEP instead of M_NOWAIT/M_WAITOK when deciding whether
to sleep on page table page allocation.

MFC r270151 (by alc):
Replace KASSERT that no PV list locks are held with a conditional
unlock.

Reviewed by:	alc
Approved by:	re (gjb)
Sponsored by:	The FreeBSD Foundation
2014-08-24 07:53:15 +00:00
kib
68885db3a4 MFC r269907:
Fix leaks of unqueued unwired pages.
2014-08-20 08:24:37 +00:00
kib
c23d839444 MFC r269643:
Weaken the requirement for the vm object lock by only asserting locked
object in vm_pager_page_unswapped(), instead of locked exclusively.
2014-08-13 06:58:42 +00:00
kib
82ab11ec35 MFC r269642:
Add wrappers to assert that vm object is unlocked and for try upgrade.
2014-08-13 06:55:30 +00:00
kib
20a6651181 MFC r268615:
Add OBJ_TMPFS_NODE flag.

MFC r268616:
Set the OBJ_TMPFS_NODE flag for vm_object of VREG tmpfs node.

MFC r269053:
Correct assertion. tmpfs vm object is always at the bottom of
the shadow chain.
2014-07-28 01:21:02 +00:00
kib
d7d6313cf4 MFC r267213 (by alc):
Add a page size field to struct vm_page.

Approved by:	alc
2014-07-24 16:29:44 +00:00
kib
4dd240dde0 MFC r267664:
Assert that the new entry is inserted into the right location in the
map entries list, and that it does not overlap with the previous and
next entries.
2014-06-27 11:42:51 +00:00
kib
15d33955d2 MFC r267630:
Add MAP_EXCL flag for mmap(2).
2014-06-26 08:30:08 +00:00
kib
5d64734c2e MFC r267766:
Use correct names for the flags.
2014-06-26 08:24:18 +00:00
kib
bab6ec9043 MFC r267254:
Make mmap(MAP_STACK) search for the available address space.

MFC r267497 (by alc):
Use local variable instead of sgrowsiz.
2014-06-23 08:08:22 +00:00
mav
c8436ca653 MFC r267391:
Introduce new "256 Bucket" zone to split requests and reduce congestion
on "128 Bucket" zone lock.
2014-06-22 21:19:19 +00:00
mav
d2e570bf14 MFC r267387:
Allocating new bucket for bucket zone, never take it from the zone itself,
since it will almost certanly fail.  Take next bigger zone instead.

This situation should not happen with original bucket zones configuration:
"32 Bucket" zone uses "64 Bucket" and vice versa.  But if "64 Bucket" zone
lock is congested, zone may grow its bucket size and start biting itself.
2014-06-22 21:18:24 +00:00
kib
ff1d21a86c MFC r266780:
Remove the assert which can be triggered by the userspace.
2014-06-04 15:18:46 +00:00
kib
2751a2ff74 MFC r266491:
Remove redundand loop.
2014-05-24 09:50:10 +00:00
alc
5b014c7d3e MFC r259107
Eliminate a redundant parameter to vm_radix_replace().

  Improve the wording of the comment describing vm_radix_replace().
2014-05-23 17:47:49 +00:00
alc
80044281eb MFC r265886, r265948
With the new-and-improved vm_fault_copy_entry() (r265843), we can always
  avoid soft page faults when adding write access to user wired entries in
  vm_map_protect().  Previously, we only avoided the soft page fault when
  the underlying pages were copy-on-write.  In other words, we avoided the
  pages faults that might sleep on page allocation, but not the trivial
  page faults to update the physical map.

  On a fork allow read-only wired pages to be copy-on-write shared between
  the parent and child processes.  Previously, we copied these pages even
  though they are read only.  However, the reason for copying them is
  historical and no longer exists.  In recent times, vm_map_protect() has
  developed the ability to copy pages when write access is added to wired
  copy-on-write pages.  So, in this case, copy-on-write sharing of wired
  pages is not to be feared.  It is not going to lead to copy-on-write
  faults on wired memory.
2014-05-23 16:46:50 +00:00
kib
476a11c228 MFC r266464:
In execve(2), postpone the free of old vmspace until the threads are resumed
and exited.
2014-05-23 09:29:04 +00:00
pho
a3e5dd5421 MFC r265534:
msync(2) must return ENOMEM and not EINVAL when the address is outside the
allowed range or when one or more pages are not mapped. This according to
The Open Group Base Specifications Issue 7.

Sponsored by:	EMC / Isilon storage division
2014-05-21 09:19:05 +00:00
alc
a7358720d6 MFC r265850
About 9% of the pmap_protect() calls being performed by
  vm_map_copy_entry() are unnecessary.
  Eliminate the unnecessary calls.
2014-05-17 14:35:18 +00:00
kib
ac64c61f5e MFC r265843:
For the upgrade case in vm_fault_copy_entry(), when the entry does not
need COW and is writeable, do not create a new backing object for the entry.

MFC r265887:
Fix locking.
2014-05-17 11:36:31 +00:00
kib
60f375b2c7 MFC r265825:
When printing the map with the ddb 'show procvm' command, do not dump
page queues for the backing objects.
2014-05-17 11:29:32 +00:00
kib
44661f3f1d MFC r265824:
Print the entry address in addition to the object.
2014-05-17 11:24:29 +00:00
alc
ab793415d0 MFC r265418
Prior to r254304, a separate function, vm_pageout_page_stats(), was used
  to periodically update the reference status of the active pages.  This
  function was called, instead of vm_pageout_scan(), when memory was not
  scarce.  The objective was to provide up to date reference status for
  active pages in case memory did become scarce and active pages needed to
  be deactivated.

  The active page queue scan performed by vm_pageout_page_stats() was
  virtually identical to that performed by vm_pageout_scan(), and so r254304
  eliminated vm_pageout_page_stats().  Instead, vm_pageout_scan() is
  called with the parameter "pass" set to zero.  The intention was that when
  pass is zero, vm_pageout_scan() would only scan the active queue.
  However, the variable page_shortage can still be greater than zero when
  memory is not scarce and vm_pageout_scan() is called with pass equal to
  zero.  Consequently, the inactive queue may be scanned and dirty pages
  laundered even though that was not intended by r254304.  This revision
  fixes that.
2014-05-13 05:26:43 +00:00
alc
498371bb43 MFC r260567
Correctly update the count of stuck pages, "addl_page_shortage", in
  vm_pageout_scan().  There were missing increments in two less common
  cases.

  Don't conflate the count of stuck pages and the pageout deficit provided
  by vm_page_alloc{,_contig}().

  Handle held pages consistently in the inactive queue scan.  In the more
  common case, we did not move the page to the tail of the queue.  Whereas,
  in the less common case, we did.  There's no particular reason to move
  the page in the less common case, so remove it.

  Perform the calculation of the page shortage for the active queue scan a
  little earlier, before the active queue lock is acquired.  The correctness
  of this calculation doesn't depend on the active queue lock being held.

  Eliminate a redundant variable, "pcount".  Use the more descriptive
  variable, "maxscan", in its place.

  Apply a few nearby style fixes, e.g., eliminate stray whitespace and
  excess parentheses.
2014-05-13 05:21:54 +00:00
des
7885a006b9 MFH (r264966): add sysctl OIDs for actual swap zone size and capacity 2014-05-12 20:48:04 +00:00
kib
68fab25080 MFC r265100:
Fix the comparision for the end of range in vm_phys_fictitious_reg_range().
2014-05-06 12:20:07 +00:00
kib
839393d336 MFC r265002:
Fix vm_fault_copy_entry() operation on upgrade; allow it to find the
pages in the shadowed objects.
2014-05-04 07:19:37 +00:00
kib
ef58943ab3 MFC r263475:
Fix two issues with /dev/mem access on amd64, both causing kernel page
faults.

First, for accesses to direct map region should check for the limit by
which direct map is instantiated.

Second, for accesses to the kernel map, use a new thread private flag
TDP_DEVMEMIO, which instructs vm_fault() to return error when fault
happens on the MAP_ENTRY_NOFAULT entry, instead of panicing.

MFC r263498:
Add change forgotten in r263475.  Make dmaplimit accessible outside
amd64/pmap.c.
2014-03-28 15:38:38 +00:00
kib
b020ab10d3 MFC r263471:
Initialize vm_map_entry member wiring_thread on the map entry creation.
2014-03-24 12:40:53 +00:00
kib
2a9993c246 MFC r263095:
Initialize paddr to handle the case of zero size.
2014-03-19 13:09:17 +00:00
kib
741b07ba7d MFC r263092:
Do not vdrop() the tmpfs vnode until it is unlocked.  The hold
reference might be the last, and then vdrop() would free the vnode.
2014-03-19 13:04:16 +00:00
glebius
8a9528c4d0 Merge r261722, r261723, r261724, r261725 from head:
several minor improvements for UMA_ZPCPU_ZONE zones.
2014-03-04 14:46:30 +00:00
glebius
322a3c94d3 Merge 261593 from head:
Provide macros that allow easily export uma(9) zone limits and
  current usage via sysctl(9).
2014-03-04 14:21:07 +00:00
attilio
cf0fa484f9 MFC r261867:
Use the right index to free swapspace after vm_page_rename().
2014-02-21 09:43:34 +00:00
dim
28bc8939f8 MFC r261896:
After r251709, avoid a clang 3.4 warning about an unused static const
variable (uma_max_ipers), when asserts are disabled.

Reviewed by:	glebius
2014-02-17 20:25:17 +00:00
marcel
60764eb6dd MFC r259908:
For ia64, use pmap_remove_pages() and not pmap_remove().
2014-02-16 20:54:26 +00:00