#
43c7dd6b |
| 19-Feb-2020 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r358075 through r358130.
|
#
e9ceb9dd |
| 19-Feb-2020 |
Jeff Roberson <jeff@FreeBSD.org> |
Don't release xbusy on kmem pages. After lockless page lookup we will not be able to guarantee that they can be racquired without blocking.
Reviewed by: kib Discussed with: markj Differential Revis
Don't release xbusy on kmem pages. After lockless page lookup we will not be able to guarantee that they can be racquired without blocking.
Reviewed by: kib Discussed with: markj Differential Revision: https://reviews.freebsd.org/D23506
show more ...
|
#
051669e8 |
| 25-Jan-2020 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r356931 through r357118.
|
#
91e31c3c |
| 23-Jan-2020 |
Jeff Roberson <jeff@FreeBSD.org> |
Consistently use busy and vm_page_valid() rather than touching page bits directly. This improves API compliance, asserts, etc.
Reviewed by: kib, markj Differential Revision: https://reviews.freebsd
Consistently use busy and vm_page_valid() rather than touching page bits directly. This improves API compliance, asserts, etc.
Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D23283
show more ...
|
#
a314aba8 |
| 12-Jan-2020 |
Mateusz Guzik <mjg@FreeBSD.org> |
vm: add missing CLTFLAG_MPSAFE annotations
This covers all vm/* files.
|
#
dfe13344 |
| 04-Jan-2020 |
Jeff Roberson <jeff@FreeBSD.org> |
UMA NUMA flag day. UMA_ZONE_NUMA was a source of confusion. Make the names more consistent with other NUMA features as UMA_ZONE_FIRSTTOUCH and UMA_ZONE_ROUNDROBIN. The system will now pick a selec
UMA NUMA flag day. UMA_ZONE_NUMA was a source of confusion. Make the names more consistent with other NUMA features as UMA_ZONE_FIRSTTOUCH and UMA_ZONE_ROUNDROBIN. The system will now pick a select a default depending on kernel configuration. API users need only specify one if they want to override the default.
Remove the UMA_XDOMAIN and UMA_FIRSTTOUCH kernel options and key only off of NUMA. XDOMAIN is now fast enough in all cases to enable whenever NUMA is.
Reviewed by: markj Discussed with: rlibby Differential Revision: https://reviews.freebsd.org/D22831
show more ...
|
#
91caa9b8 |
| 07-Dec-2019 |
Mateusz Guzik <mjg@FreeBSD.org> |
vm: fix sysctl vm.kstack_cache_size change report
Cache gets resized correctly, but sysctl reports the wrong number: # sysctl vm.kstack_cache_size=512 vm.kstack_cache_size: 128 -> 128
patched: vm.k
vm: fix sysctl vm.kstack_cache_size change report
Cache gets resized correctly, but sysctl reports the wrong number: # sysctl vm.kstack_cache_size=512 vm.kstack_cache_size: 128 -> 128
patched: vm.kstack_cache_size: 128 -> 512
Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D22717 Fixes: r355002 "Revise the page cache size policy."
show more ...
|
#
0f9e06e1 |
| 02-Dec-2019 |
Jeff Roberson <jeff@FreeBSD.org> |
Fix a few places that free a page from an object without busy held. This is tightening constraints on busy as a precursor to lockless page lookup and should largely be a NOP for these cases.
Review
Fix a few places that free a page from an object without busy held. This is tightening constraints on busy as a precursor to lockless page lookup and should largely be a NOP for these cases.
Reviewed by: alc, kib, markj Differential Revision: https://reviews.freebsd.org/D22611
show more ...
|
#
003cf08b |
| 22-Nov-2019 |
Mark Johnston <markj@FreeBSD.org> |
Revise the page cache size policy.
In r353734 the use of the page caches was limited to systems with a relatively large amount of RAM per CPU. This was to mitigate some issues reported with the sys
Revise the page cache size policy.
In r353734 the use of the page caches was limited to systems with a relatively large amount of RAM per CPU. This was to mitigate some issues reported with the system not able to keep up with memory pressure in cases where it had been able to do so prior to the addition of the direct free pool cache. This change re-enables those caches.
The change modifies uma_zone_set_maxcache(), which was introduced specifically for the page cache zones. Rather than using it to limit only the full bucket cache, have it also set uz_count_max to provide an upper bound on the per-CPU cache size that is consistent with the number of items requested. Remove its return value since it has no use.
Enable the page cache zones unconditionally, and limit them to 0.1% of the domain's pages. The limit can be overridden by the vm.pgcache_zone_max tunable as before.
Change the item size parameter passed to uma_zcache_create() to the correct size, and stop setting UMA_ZONE_MAXBUCKET. This allows the page cache buckets to be adaptively sized, like the rest of UMA's caches. This also causes the initial bucket size to be small, so only systems which benefit from large caches will get them.
Reviewed by: gallatin, jeff MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22393
show more ...
|
Revision tags: release/12.1.0 |
|
#
0f80acb9 |
| 19-Sep-2019 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r352436 through r352536.
|
#
4a9c211a |
| 19-Sep-2019 |
Allan Jude <allanjude@FreeBSD.org> |
sys/vm/vm_glue.c: Incorrect function name in panic string
Use __func__ to avoid this issue in the future.
Submitted by: Wuyang Chung <wuyang.chung1@gmail.com> Reviewed by: markj, emaste Obtained fr
sys/vm/vm_glue.c: Incorrect function name in panic string
Use __func__ to avoid this issue in the future.
Submitted by: Wuyang Chung <wuyang.chung1@gmail.com> Reviewed by: markj, emaste Obtained from: https://github.com/freebsd/freebsd/pull/410
show more ...
|
#
61c1328e |
| 13-Sep-2019 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r352105 through r352307.
|
#
c7575748 |
| 10-Sep-2019 |
Jeff Roberson <jeff@FreeBSD.org> |
Replace redundant code with a few new vm_page_grab facilities: - VM_ALLOC_NOCREAT will grab without creating a page. - vm_page_grab_valid() will grab and page in if necessary. - vm_page_busy_acqui
Replace redundant code with a few new vm_page_grab facilities: - VM_ALLOC_NOCREAT will grab without creating a page. - vm_page_grab_valid() will grab and page in if necessary. - vm_page_busy_acquire() automates some busy acquire loops.
Discussed with: alc, kib, markj Tested by: pho (part of larger branch) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21546
show more ...
|
#
fee2a2fa |
| 09-Sep-2019 |
Mark Johnston <markj@FreeBSD.org> |
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 pa
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
show more ...
|
#
c5c3ba6b |
| 03-Sep-2019 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r351317 through r351731.
|
#
b5d239cb |
| 28-Aug-2019 |
Mark Johnston <markj@FreeBSD.org> |
Wire pages in vm_page_grab() when appropriate.
uiomove_object_page() and exec_map_first_page() would previously wire a page after having grabbed it. Ask vm_page_grab() to perform the wiring instead
Wire pages in vm_page_grab() when appropriate.
uiomove_object_page() and exec_map_first_page() would previously wire a page after having grabbed it. Ask vm_page_grab() to perform the wiring instead: this removes some redundant code, and is cheaper in the case where the requested page is not resident since the page allocator can be asked to initialize the page as wired, whereas a separate vm_page_wire() call requires the page lock.
In vm_imgact_hold_page(), use vm_page_unwire_noq() instead of vm_page_unwire(PQ_NONE). The latter ensures that the page is dequeued before returning, but this is unnecessary since vm_page_free() will trigger a batched dequeue of the page.
Reviewed by: alc, kib Tested by: pho (part of a larger patch) MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21440
show more ...
|
#
b48d4efe |
| 25-Aug-2019 |
Mark Johnston <markj@FreeBSD.org> |
Handle UMA_ANYDOMAIN in kstack_import().
The kernel thread stack zone performs first-touch allocations by default, and must handle the case where the local memory domain is empty. For most UMA zone
Handle UMA_ANYDOMAIN in kstack_import().
The kernel thread stack zone performs first-touch allocations by default, and must handle the case where the local memory domain is empty. For most UMA zones this is handled in the keg layer, but cache zones currently must implement a policy for this case. Simply use a round-robin policy if UMA_ANYDOMAIN is passed.
Reported and tested by: bcran Reviewed by: kib Sponsored by: The FreeBSD Foundation
show more ...
|
#
0b26119b |
| 07-Aug-2019 |
Jeff Roberson <jeff@FreeBSD.org> |
Cache kernel stacks in UMA. This gives us NUMA support, better concurrency, and more statistics.
Reviewed by: kib, markj Tested by: pho Sponsored by: Netflix Differential Revision: https://reviews.
Cache kernel stacks in UMA. This gives us NUMA support, better concurrency, and more statistics.
Reviewed by: kib, markj Tested by: pho Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20931
show more ...
|
#
a63915c2 |
| 28-Jul-2019 |
Alan Somers <asomers@FreeBSD.org> |
MFHead @r350386
Sponsored by: The FreeBSD Foundation
|
#
eeacb3b0 |
| 08-Jul-2019 |
Mark Johnston <markj@FreeBSD.org> |
Merge the vm_page hold and wire mechanisms.
The hold_count and wire_count fields of struct vm_page are separate reference counters with similar semantics. The remaining essential differences are th
Merge the vm_page hold and wire mechanisms.
The hold_count and wire_count fields of struct vm_page are separate reference counters with similar semantics. The remaining essential differences are that holds are not counted as a reference with respect to LRU, and holds have an implicit free-on-last unhold semantic whereas vm_page_unwire() callers must explicitly determine whether to free the page once the last reference to the page is released.
This change removes the KPIs which directly manipulate hold_count. Functions such as vm_fault_quick_hold_pages() now return wired pages instead. Since r328977 the overhead of maintaining LRU for wired pages is lower, and in many cases vm_fault_quick_hold_pages() callers would swap holds for wirings on the returned pages anyway, so with this change we remove a number of page lock acquisitions.
No functional change is intended. __FreeBSD_version is bumped.
Reviewed by: alc, kib Discussed with: jeff Discussed with: jhb, np (cxgbe) Tested by: pho (previous version) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D19247
show more ...
|
Revision tags: release/11.3.0 |
|
#
e532a999 |
| 20-Jun-2019 |
Alan Somers <asomers@FreeBSD.org> |
MFHead @349234
Sponsored by: The FreeBSD Foundation
|
#
88ea538a |
| 07-Jun-2019 |
Mark Johnston <markj@FreeBSD.org> |
Replace uses of vm_page_unwire(m, PQ_NONE) with vm_page_unwire_noq(m).
These calls are not the same in general: the former will dequeue the page if it is enqueued, while the latter will just leave i
Replace uses of vm_page_unwire(m, PQ_NONE) with vm_page_unwire_noq(m).
These calls are not the same in general: the former will dequeue the page if it is enqueued, while the latter will just leave it alone. But, all existing uses of the former apply to unmanaged pages, which are never enqueued in the first place. No functional change intended.
Reviewed by: kib MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D20470
show more ...
|
#
0269ae4c |
| 06-Jun-2019 |
Alan Somers <asomers@FreeBSD.org> |
MFHead @348740
Sponsored by: The FreeBSD Foundation
|
#
54a3a114 |
| 13-May-2019 |
Mark Johnston <markj@FreeBSD.org> |
Provide separate accounting for user-wired pages.
Historically we have not distinguished between kernel wirings and user wirings for accounting purposes. User wirings (via mlock(2)) were subject to
Provide separate accounting for user-wired pages.
Historically we have not distinguished between kernel wirings and user wirings for accounting purposes. User wirings (via mlock(2)) were subject to a global limit on the number of wired pages, so if large swaths of physical memory were wired by the kernel, as happens with the ZFS ARC among other things, the limit could be exceeded, causing user wirings to fail.
The change adds a new counter, v_user_wire_count, which counts the number of virtual pages wired by user processes via mlock(2) and mlockall(2). Only user-wired pages are subject to the system-wide limit which helps provide some safety against deadlocks. In particular, while sources of kernel wirings typically support some backpressure mechanism, there is no way to reclaim user-wired pages shorting of killing the wiring process. The limit is exported as vm.max_user_wired, renamed from vm.max_wired, and changed from u_int to u_long.
The choice to count virtual user-wired pages rather than physical pages was done for simplicity. There are mechanisms that can cause user-wired mappings to be destroyed while maintaining a wiring of the backing physical page; these make it difficult to accurately track user wirings at the physical page layer.
The change also closes some holes which allowed user wirings to succeed even when they would cause the system limit to be exceeded. For instance, mmap() may now fail with ENOMEM in a process that has called mlockall(MCL_FUTURE) if the new mapping would cause the user wiring limit to be exceeded.
Note that bhyve -S is subject to the user wiring limit, which defaults to 1/3 of physical RAM. Users that wish to exceed the limit must tune vm.max_user_wired.
Reviewed by: kib, ngie (mlock() test changes) Tested by: pho (earlier version) MFC after: 45 days Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D19908
show more ...
|
Revision tags: release/12.0.0 |
|
#
c6879c6c |
| 23-Oct-2018 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r339015 through r339669.
|