Improve vmem tuning for platforms without a direct map.
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
This commit is contained in:
parent
f42230d856
commit
2b6010705c
@ -689,9 +689,11 @@ vmem_startup(void)
|
||||
/*
|
||||
* Reserve enough tags to allocate new tags. We allow multiple
|
||||
* CPUs to attempt to allocate new tags concurrently to limit
|
||||
* false restarts in UMA.
|
||||
* false restarts in UMA. vmem_bt_alloc() allocates from a per-domain
|
||||
* arena, which may involve importing a range from the kernel arena,
|
||||
* so we need to keep at least 2 * BT_MAXALLOC tags reserved.
|
||||
*/
|
||||
uma_zone_reserve(vmem_bt_zone, BT_MAXALLOC * (mp_ncpus + 1) / 2);
|
||||
uma_zone_reserve(vmem_bt_zone, 2 * BT_MAXALLOC * mp_ncpus);
|
||||
uma_zone_set_allocf(vmem_bt_zone, vmem_bt_alloc);
|
||||
#endif
|
||||
}
|
||||
|
@ -124,8 +124,8 @@ SYSCTL_ULONG(_vm, OID_AUTO, max_kernel_address, CTLFLAG_RD,
|
||||
#if VM_NRESERVLEVEL > 0
|
||||
#define KVA_QUANTUM_SHIFT (VM_LEVEL_0_ORDER + PAGE_SHIFT)
|
||||
#else
|
||||
/* On non-superpage architectures want large import sizes. */
|
||||
#define KVA_QUANTUM_SHIFT (10 + PAGE_SHIFT)
|
||||
/* On non-superpage architectures we want large import sizes. */
|
||||
#define KVA_QUANTUM_SHIFT (8 + PAGE_SHIFT)
|
||||
#endif
|
||||
#define KVA_QUANTUM (1 << KVA_QUANTUM_SHIFT)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user