summaryrefslogtreecommitdiff
path: root/sys/vm/vm_kern.c
Commit message (Collapse)AuthorAgeFilesLines
* Revert r368523 which fixed contig allocs waiting forever.Bryan Drewery2020-12-151-16/+4
| | | | | | | | | | This needs to account for empty NUMA domains or domains which do not satisfy the requested range. Discussed with: markj Notes: svn path=/head/; revision=368673
* contig allocs: Don't retry forever on M_WAITOK.Bryan Drewery2020-12-101-4/+16
| | | | | | | | | | | | | | | | | | | | | | This restores behavior from before domain iterators were added in r327895 and r327896. The vm_domainset_iter_policy() will do a vm_wait_doms() and then restart its iterator when M_WAITOK is set. It will also force the containing loop to have M_NOWAIT. So we get an unbounded retry loop rather than the intended bounded retries that kmem_alloc_contig_pages() already handles. This also restores M_WAITOK to the vmem_alloc() call in kmem_alloc_attr_domain() and kmem_alloc_contig_domain(). Reviewed by: markj, kib MFC after: 2 weeks Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D27507 Notes: svn path=/head/; revision=368523
* vm_phys: Try to clean up NUMA KPIsMark Johnston2020-11-191-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | It can useful for code outside the VM system to look up the NUMA domain of a page backing a virtual or physical address, specifically when creating NUMA-aware data structures. We have _vm_phys_domain() for this, but the leading underscore implies that it's an internal function, and vm_phys.h has dependencies on a number of other headers. Rename vm_phys_domain() to vm_page_domain(), and _vm_phys_domain() to vm_phys_domain(). Make the latter an inline function. Add _vm_phys.h and define struct vm_phys_seg there so that it's easier to use in other headers. Include it from vm_page.h so that vm_page_domain() can be defined there. Include machine/vmparam.h from _vm_phys.h since it depends directly on some constants defined there. Reviewed by: alc Reviewed by: dougm, kib (earlier versions) Differential Revision: https://reviews.freebsd.org/D27207 Notes: svn path=/head/; revision=367828
* Use a large kmem arena import size on NUMA systems.Mark Johnston2020-08-261-2/+16
| | | | | | | | | | | | | | | This helps minimize internal fragmentation that occurs when 2MB imports are interleaved across NUMA domains. Virtually all KVA allocations on direct map platforms consume more than one page, so the fragmentation manifests as runs of 511 4KB page mappings in the kernel. Reviewed by: alc, kib Tested by: pho Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26050 Notes: svn path=/head/; revision=364820
* Commit a missing piece of r364302.Mark Johnston2020-08-171-6/+4
| | | | | | | | | | This had failed to apply due to a merge conflict. Reported by: Jenkins MFC with: r364302 Notes: svn path=/head/; revision=364306
* Remove the VM map zone.Mark Johnston2020-08-171-18/+14
| | | | | | | | | | | | | | | | | | | | Today, the zone is only used to allocate a trio of kernel maps: the kernel map itself, and the exec and pipe submaps. Maps for user processes are dynamically allocated but are embedded in the vmspace structure, which is allocated from its own zone. Make the aforementioned kernel maps statically allocated and get rid of the zone. While here, remove a stale comment above vmspace_alloc() and change the names of locks initialized in vm_map_init() to match vmspace_zinit(). Reported by: alc Reviewed by: alc, kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26052 Notes: svn path=/head/; revision=364302
* Factor out the kmem contig page alloc and reclamation code.Mark Johnston2020-04-211-34/+39
| | | | | | | | | | | | | | | kmem_alloc_attr_domain() and kmem_alloc_contig_domain() duplicated each other's page allocation and reclamation logic. Place it in a single function to make it easier to add additional consumers. No functional change intended. Reviewed by: jeff, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D24475 Notes: svn path=/head/; revision=360154
* Minimize conditional compilation for handling of M_EXEC.Mark Johnston2020-04-211-10/+3
| | | | | | | | | | | | This simplifies some planned changes. No functional change intended. Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D24474 Notes: svn path=/head/; revision=360153
* Don't release xbusy on kmem pages. After lockless page lookup we will notJeff Roberson2020-02-191-4/+1
| | | | | | | | | | | be able to guarantee that they can be racquired without blocking. Reviewed by: kib Discussed with: markj Differential Revision: https://reviews.freebsd.org/D23506 Notes: svn path=/head/; revision=358098
* Remove sparc64 kernel supportWarner Losh2020-02-031-1/+1
| | | | | | | | | Remove all sparc64 specific files Remove all sparc64 ifdefs Removee indireeect sparc64 ifdefs Notes: svn path=/head/; revision=357455
* Consistently use busy and vm_page_valid() rather than touching page bitsJeff Roberson2020-01-231-6/+9
| | | | | | | | | | directly. This improves API compliance, asserts, etc. Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D23283 Notes: svn path=/head/; revision=357017
* Simplify VM and UMA startup by eliminating boot pages. Instead use carefulJeff Roberson2020-01-161-0/+9
| | | | | | | | | | | | | | | ordering to allocate early pages in the same way boot pages were but only as needed. After the KVA allocator has started up we allocate the KVA that we consumed during boot. This also makes the boot pages freeable since they have vm_page structures allocated with the rest of memory. Parts of this patch were written and tested by markj. Reviewed by: glebius, markj Differential Revision: https://reviews.freebsd.org/D23102 Notes: svn path=/head/; revision=356776
* vm: add missing CLTFLAG_MPSAFE annotationsMateusz Guzik2020-01-121-1/+1
| | | | | | | This covers all vm/* files. Notes: svn path=/head/; revision=356653
* Make page busy state deterministic on free. Pages must be xbusy whenJeff Roberson2019-12-221-0/+1
| | | | | | | | | | | | | | | | | | | removed from objects including calls to free. Pages must not be xbusy when freed and not on an object. Strengthen assertions to match these expectations. In practice very little code had to change busy handling to meet these rules but we can now make stronger guarantees to busy holders and avoid conditionally dropping busy in free. Refine vm_page_remove() and vm_page_replace() semantics now that we have stronger guarantees about busy state. This removes redundant and potentially problematic code that has proliferated. Discussed with: markj Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D22822 Notes: svn path=/head/; revision=356002
* Apply mapping protections to preloaded kernel modules on amd64.Mark Johnston2019-10-181-0/+8
| | | | | | | | | | | | | | With an upcoming change the amd64 kernel will map preloaded files RW instead of RWX, so the kernel linker must adjust protections appropriately using pmap_change_prot(). Reviewed by: kib MFC after: 1 month Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21860 Notes: svn path=/head/; revision=353730
* Map the vm_page array into KVA on amd64.Mark Johnston2019-09-031-1/+13
| | | | | | | | | | | | | | | | | | | | r351198 allows the kernel to use domain-local memory to back the vm_page array (up to 2MB boundaries) and reserves a separate PML4 entry for that purpose. One consequence of that change is that the vm_page array is no longer present in minidumps, which only adds pages mapped above VM_MIN_KERNEL_ADDRESS. To avoid the friction caused by having kernel data structures mapped below VM_MIN_KERNEL_ADDRESS, map the vm_page array starting at VM_MIN_KERNEL_ADDRESS instead of using a dedicated PML4 entry. Reviewed by: kib Discussed with: jeff Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21491 Notes: svn path=/head/; revision=351742
* Unconditionally enable debug.vm_lowmem.Mark Johnston2019-08-211-2/+0
| | | | | | | | | | | It is useful for testing purposes to be able to drain UMA caches, so do not limit the sysctl to DIAGNOSTIC kernels. MFC after: 1 week Sponsored by: Netflix Notes: svn path=/head/; revision=351332
* Replace uses of vm_page_unwire(m, PQ_NONE) with vm_page_unwire_noq(m).Mark Johnston2019-06-071-1/+1
| | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=348785
* Eliminate adj_free field from vm_map_entry.Konstantin Belousov2019-03-291-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Drop the adj_free field from vm_map_entry_t. Refine the max_free field so that p->max_free is the size of the largest gap with one endpoint in the subtree rooted at p. Change vm_map_findspace so that, first, the address-based splay is restricted to tree nodes with large-enough max_free value, to avoid searching for the right starting point in a subtree where all the gaps are too small. Second, when the address search leads to a tree search for the first large-enough gap, that gap is the subject of a splay-search that brings the gap to the top of the tree, so that an immediate insertion will take constant time. Break up the splay code into separate components, one for searching and breaking up the tree and another for reassembling it. Use these components, and not splay itself, for linking and unlinking. Drop the after-where parameter to link, as it is computed as a side-effect of the splay search. Submitted by: Doug Moore <dougm@rice.edu> Reviewed by: markj Tested by: pho MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D17794 Notes: svn path=/head/; revision=345702
* Improve vmem tuning for platforms without a direct map.Mark Johnston2019-02-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | On platforms without a direct map (i.e., platforms without UMA_MD_SMALL_ALLOC defined), the boundary tag allocator reserves a number of tags for use when allocating a new slab of boundary tags, as such platforms require free boundary tags in order to allocate boundary tags. r327899 increased the number of boundary tags required for a KVA allocation in the worst case, and the aforementioned reservation was not updated accordingly. In some cases, this could lead to a system hang. Fix the problem by increasing this reservation. Also reduce KVA_QUANTUM on systems lacking superpage support. The previous import quantum (4MB with a 4KB page size) was quite large for systems with limited KVA, and fragmentation in kernel_arena could cause kernel memory allocation failures even with a substantial amount of free KVA. Reported and tested by: jhibbits Reviewed by: alc, kib No objections: jeff MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D19337 Notes: svn path=/head/; revision=344550
* contigmalloc: handle M_EXEC.Konstantin Belousov2019-02-071-2/+4
| | | | | | | | | | Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D19092 Notes: svn path=/head/; revision=343850
* Avoid specifying VM_PROT_EXECUTE in mappings from pipe_map and exec_map.Mark Johnston2018-11-061-2/+2
| | | | | | | | | | | | | | | These submaps are used for mapping pipe buffers and execv() argument strings respectively, so there's no need for such mappings to have execute permissions. Reported by: jhb Reviewed by: alc, jhb, kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D17827 Notes: svn path=/head/; revision=340205
* Add malloc_domainset(9) and _domainset variants to other allocator KPIs.Mark Johnston2018-10-301-7/+33
| | | | | | | | | | | | | | | | | | | | | | | | Remove malloc_domain(9) and most other _domain KPIs added in r327900. The new functions allow the caller to specify a general NUMA domain selection policy, rather than specifically requesting an allocation from a specific domain. The latter policy tends to interact poorly with M_WAITOK, resulting in situations where a caller is blocked indefinitely because the specified domain is depleted. Most existing consumers of the _domain KPIs are converted to instead use a DOMAINSET_PREF() policy, in which we fall back to other domains to satisfy the allocation request. This change also defines a set of DOMAINSET_FIXED() policies, which only permit allocations from the specified domain. Discussed with: gallatin, jeff Reported and tested by: pho (previous version) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D17418 Notes: svn path=/head/; revision=339927
* Fix some problems that manifest when NUMA domain 0 is empty.Mark Johnston2018-10-301-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - In uma_prealloc(), we need to check for an empty domain before the first allocation attempt, not after. Fix this by switching uma_prealloc() to use a vm_domainset iterator, which addresses the secondary issue of using a signed domain identifier in round-robin iteration. - Don't automatically create a page daemon for domain 0. - In domainset_empty_vm(), recompute ds_cnt and ds_order after excluding empty domains; otherwise we may frequently specify an empty domain when calling in to the page allocator, wasting CPU time. Convert DOMAINSET_PREF() policies for empty domains to round-robin. - When freeing bootstrap pages, don't count them towards the per-domain total page counts for now: some vm_phys segments are created before the SRAT is parsed and are thus always identified as being in domain 0 even when they are not. Then, when bootstrap pages are freed, they are added to a domain that we had previously thought was empty. Until this is corrected, we simply exclude them from the per-domain page count. Reported and tested by: Rajesh Kumar <rajfbsd@gmail.com> Reviewed by: gallatin MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D17704 Notes: svn path=/head/; revision=339925
* Refactor domainset iterators for use by malloc(9) and UMA.Mark Johnston2018-10-231-6/+6
| | | | | | | | | | | | | | | | | | | | | | Before this change we had two flavours of vm_domainset iterators: "page" and "malloc". The latter was only used for kmem_*() and hard-coded its behaviour based on kernel_object's policy. Moreover, its use contained a race similar to that fixed by r338755 since the kernel_object's iterator was being run without the object lock. In some cases it is useful to be able to explicitly specify a policy (domainset) or policy+iterator (domainset_ref) when performing memory allocations. To that end, refactor the vm_dominset_* KPI to permit this, and get rid of the "malloc" domainset_iter KPI in the process. Reviewed by: jeff (previous version) Tested by: pho (part of a larger patch) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D17417 Notes: svn path=/head/; revision=339661
* Allow empty NUMA memory domains to support Threadripper2Andrew Gallatin2018-10-011-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | The AMD Threadripper 2990WX is basically a slightly crippled Epyc. Rather than having 4 memory controllers, one per NUMA domain, it has only 2 memory controllers enabled. This means that only 2 of the 4 NUMA domains can be populated with physical memory, and the others are empty. Add support to FreeBSD for empty NUMA domains by: - creating empty memory domains when parsing the SRAT table, rather than failing to parse the table - not running the pageout deamon threads in empty domains - adding defensive code to UMA to avoid allocating from empty domains - adding defensive code to cpuset to avoid binding to an empty domain Thanks to Jeff for suggesting this strategy. Reviewed by: alc, markj Approved by: re (gjb@) Differential Revision: https://reviews.freebsd.org/D1683 Notes: svn path=/head/; revision=339043
* Ensure that "domain" is initialized when vm_ndomains == 1.Mark Johnston2018-09-241-1/+3
| | | | | | | | Reported by: alc Approved by: re (gjb) Notes: svn path=/head/; revision=338906
* Ensure that imports into per-domain kmem arenas are KVA_QUANTUM-aligned.Mark Johnston2018-09-201-23/+21
| | | | | | | | | | | | | | | | | | The old code appears to assume that vmem_alloc() would import size-aligned KVA chunks from the parent kernel_arena, but vmem doesn't provide this guarantee. Also remove the unused global RWX arena and add comments explaining why we have per-domain arenas. Reported by: alc Reviewed by: alc, kib (previous version) Approved by: re (gjb) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D17249 Notes: svn path=/head/; revision=338836
* Change the domain selection policy in kmem_back().Mark Johnston2018-09-201-14/+31
| | | | | | | | | | | | | | Ensure that pages backing the same virtual large page come from the same physical domain, as kmem_malloc_domain() does. PR: 231038 Reviewed by: alc, kib Approved by: re (gjb) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D17248 Notes: svn path=/head/; revision=338830
* Move kernel vmem arena initialization to vm_kern.c.Mark Johnston2018-09-191-0/+82
| | | | | | | | | | | | | | | This keeps the initialization coupled together with the kmem_* KPI implementation, which is the main user of these arenas. No functional change intended. Reviewed by: alc Approved by: re (gjb) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D17247 Notes: svn path=/head/; revision=338806
* Eliminate the arena parameter to kmem_free(). Implicitly this corrects anAlan Cox2018-08-251-24/+21
| | | | | | | | | | | | | | | | | | | | | | error in the function hypercall_memfree(), where the wrong arena was being passed to kmem_free(). Introduce a per-page flag, VPO_KMEM_EXEC, to mark physical pages that are mapped in kmem with execute permissions. Use this flag to determine which arena the kmem virtual addresses are returned to. Eliminate UMA_SLAB_KRWX. The introduction of VPO_KMEM_EXEC makes it redundant. Update the nearby comment for UMA_SLAB_KERNEL. Reviewed by: kib, markj Discussed with: jeff Approved by: re (marius) Differential Revision: https://reviews.freebsd.org/D16845 Notes: svn path=/head/; revision=338318
* Eliminate kmem_malloc()'s unused arena parameter. (The arena parameterAlan Cox2018-08-211-1/+1
| | | | | | | | | | | | became unused in FreeBSD 12.x as a side-effect of the NUMA-related changes.) Reviewed by: kib, markj Discussed with: jeff, re@ Differential Revision: https://reviews.freebsd.org/D16825 Notes: svn path=/head/; revision=338143
* Eliminate kmem_alloc_contig()'s unused arena parameter.Alan Cox2018-08-201-6/+2
| | | | | | | | | Reviewed by: hselasky, kib, markj Discussed with: jeff Differential Revision: https://reviews.freebsd.org/D16799 Notes: svn path=/head/; revision=338107
* Eliminate the unused arena parameter from kmem_alloc_attr().Alan Cox2018-08-181-5/+2
| | | | | | | | Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D16793 Notes: svn path=/head/; revision=338030
* Eliminate the arena parameter to kmem_malloc_domain(). It is redundant.Alan Cox2018-08-181-9/+4
| | | | | | | | | | | The domain and flags parameters suffice. In fact, the related functions kmem_alloc_{attr,contig}_domain() don't have an arena parameter. Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D16713 Notes: svn path=/head/; revision=338018
* Add the required page accounting to kmem_bootstrap_free().Mark Johnston2018-08-031-0/+4
| | | | | | | | | | Reviewed by: alc, kib MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D16581 Notes: svn path=/head/; revision=337265
* Fix handling of KVA in kmem_bootstrap_free().Mark Johnston2018-07-271-4/+5
| | | | | | | | | | | | | | | | | | | | | | | Do not use vm_map_remove() to release KVA back to the system. Because kernel map entries do not have an associated VM object, with r336030 the vm_map_remove() call will not update the kernel page tables. Avoid relying on the vm_map layer and instead update the pmap and release KVA to the kernel arena directly in kmem_bootstrap_free(). Because the pmap updates will generally result in superpage demotions, modify pmap_init() to insert PTPs shadowed by superpage mappings into the kernel pmap's radix tree. While here, port r329171 to i386. Reported by: alc Reviewed by: alc, kib X-MFC with: r336505 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D16426 Notes: svn path=/head/; revision=336764
* Have preload_delete_name() free pages backing preloaded data.Mark Johnston2018-07-191-0/+32
| | | | | | | | | | | | | | | | On i386 and amd64, add a vm_phys segment for physical memory used to store the kernel binary and other preloaded data. This makes it possible to free such memory back to the system once it is no longer needed, e.g., when a preloaded kernel module is unloaded. Previously, it would have remained unused. Reviewed by: kib, royger MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D16330 Notes: svn path=/head/; revision=336505
* Make UMA and malloc(9) return non-executable memory in most cases.Jonathan T. Looney2018-06-131-16/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most kernel memory that is allocated after boot does not need to be executable. There are a few exceptions. For example, kernel modules do need executable memory, but they don't use UMA or malloc(9). The BPF JIT compiler also needs executable memory and did use malloc(9) until r317072. (Note that a side effect of r316767 was that the "small allocation" path in UMA on amd64 already returned non-executable memory. This meant that some calls to malloc(9) or the UMA zone(9) allocator could return executable memory, while others could return non-executable memory. This change makes the behavior consistent.) This change makes malloc(9) return non-executable memory unless the new M_EXEC flag is specified. After this change, the UMA zone(9) allocator will always return non-executable memory, and a KASSERT will catch attempts to use the M_EXEC flag to allocate executable memory using uma_zalloc() or its variants. Allocations that do need executable memory have various choices. They may use the M_EXEC flag to malloc(9), or they may use a different VM interfact to obtain executable pages. Now that malloc(9) again allows executable allocations, this change also reverts most of r317072. PR: 228927 Reviewed by: alc, kib, markj, jhb (previous version) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D15691 Notes: svn path=/head/; revision=335068
* Use per-domain locks for vm page queue free. Move paging control fromJeff Roberson2018-02-061-9/+10
| | | | | | | | | | | | | | global to per-domain state. Protect reservations with the free lock from the domain that they belong to. Refactor to make vm domains more of a first class object. Reviewed by: markj, kib, gallatin Tested by: pho Sponsored by: Netflix, Dell/EMC Isilon Differential Revision: https://reviews.freebsd.org/D14000 Notes: svn path=/head/; revision=328954
* Implement NUMA policy for kmem_*(9). This maintains compatibility withJeff Roberson2018-01-121-27/+143
| | | | | | | | | | | | | reservations by giving each memory domain its own KVA space in vmem that is naturally aligned on superpage boundaries. Reviewed by: alc, markj, kib (some objections) Sponsored by: Netflix, Dell/EMC Isilon Tested by; pho Differential Revision: https://reviews.freebsd.org/D13289 Notes: svn path=/head/; revision=327899
* SPDX: Consider code from Carnegie-Mellon University.Pedro F. Giffuni2017-11-301-1/+1
| | | | | | | Interesting cases, most likely from CMU Mach sources. Notes: svn path=/head/; revision=326403
* Eliminate kmem_arena and kmem_object in preparation for further NUMA commits.Jeff Roberson2017-11-281-10/+16
| | | | | | | | | | | | | | | | | | | | The arena argument to kmem_*() is now only used in an assert. A follow-up commit will remove the argument altogether before we freeze the API for the next release. This replaces the hard limit on kmem size with a soft limit imposed by UMA. When the soft limit is exceeded we periodically wakeup the UMA reclaim thread to attempt to shrink KVA. On 32bit architectures this should behave much more gracefully as we exhaust KVA. On 64bit the limits are likely never hit. Reviewed by: markj, kib (some objections) Discussed with: alc Tested by: pho Sponsored by: Netflix / Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D13187 Notes: svn path=/head/; revision=326347
* sys: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326023
* Replace manyinstances of VM_WAIT with blocking page allocation flagsJeff Roberson2017-11-081-5/+10
| | | | | | | | | | | | | | | | | | | similar to the kernel memory allocator. This simplifies NUMA allocation because the domain will be known at wait time and races between failure and sleeping are eliminated. This also reduces boilerplate code and simplifies callers. A wait primitive is supplied for uma zones for similar reasons. This eliminates some non-specific VM_WAIT calls in favor of more explicit sleeps that may be satisfied without new pages. Reviewed by: alc, kib, markj Tested by: pho Sponsored by: Netflix, Dell/EMC Isilon Notes: svn path=/head/; revision=325530
* ANSIfy vm_kern.cEd Maste2017-10-131-14/+5
| | | | | | | | | PR: 222673 Submitted by: ota@j.email.ne.jp MFC after: 1 week Notes: svn path=/head/; revision=324595
* Add vm_page_alloc_after().Mark Johnston2017-08-151-5/+8
| | | | | | | | | | | | | | | | | | | | This is a variant of vm_page_alloc() which accepts an additional parameter: the page in the object with largest index that is smaller than the requested index. vm_page_alloc() finds this page using a lookup in the object's radix tree, but in some cases its identity is already known, allowing the lookup to be elided. Modify kmem_back() and vm_page_grab_pages() to use vm_page_alloc_after(). vm_page_alloc() is converted into a trivial wrapper of vm_page_alloc_after(). Suggested by: alc Reviewed by: alc, kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D11984 Notes: svn path=/head/; revision=322547
* Micro-optimize kmem_unback().Mark Johnston2017-08-111-4/+6
| | | | | | | | | | | | | | We can remove some unnecessary object radix tree lookups by using the object memq to iterate over pages in the specified range. This does not, however, eliminate the lookup needed in vm_page_free_toq() to remove each tree entry. Reviewed by: alc, kib (previous revision) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D11945 Notes: svn path=/head/; revision=322391
* Use atop() instead of OFF_TO_IDX() for convertion of addresses orKonstantin Belousov2017-03-141-8/+6
| | | | | | | | | | | addresses offsets, as intended. Suggested and reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Notes: svn path=/head/; revision=315281
* Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436