svn commit: r334819 - head/sys/vm
Kubilay Kocak
koobs at FreeBSD.org
Fri Jun 8 05:07:07 UTC 2018
On 8/06/2018 10:15 am, Gleb Smirnoff wrote:
> Author: glebius
> Date: Fri Jun 8 00:15:08 2018
> New Revision: 334819
> URL: https://svnweb.freebsd.org/changeset/base/334819
>
> Log:
> UMA memory debugging enabled with INVARIANTS consists of two things:
> trashing freed memory and checking that allocated memory is properly
> trashed, and also of keeping a bitset of freed items. Trashing/checking
> creates a lot of CPU cache poisoning, while keeping debugging bitsets
> consistent creates a lot of contention on UMA zone lock(s). The performance
> difference between INVARIANTS kernel and normal one is mostly attributed
> to UMA debugging, rather than to all KASSERT checks in the kernel.
>
> Add loader tunable vm.debug.divisor that allows either to turn off UMA
Is 'sample interval' a standard/common enough term for this kind of
mechanism to name the sysctl with it rather than the implementation?
Or 'sample frequency'
> debugging completely, or turn it on only for a fraction of allocations,
> while still running all KASSERTs in kernel. That allows to run INVARIANTS
> kernels in production environments without reducing load by orders of
> magnitude, but still doing useful extra checks.
>
> Default value is 1, meaning debug every allocation. Value of 0 would
> disable UMA debugging completely. Values above 1 enable debugging only
> for every N-th item. It isn't possible to strictly follow the number,
> but still amount of debugging is reduced roughly by (N-1)/N percent.
>
> Sponsored by: Netflix
> Differential Revision: https://reviews.freebsd.org/D15199
>
> +static u_int dbg_divisor = 1;
> +SYSCTL_UINT(_vm_debug, OID_AUTO, divisor,
> + CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &dbg_divisor, 0,
> + "Debug & thrash every this item in memory allocator");
Might "Nth" be better (more explicit) here ---^ ?
> +static counter_u64_t uma_dbg_cnt = EARLY_COUNTER;
> +static counter_u64_t uma_skip_cnt = EARLY_COUNTER;
> +SYSCTL_COUNTER_U64(_vm_debug, OID_AUTO, trashed, CTLFLAG_RD,
> + &uma_dbg_cnt, "memory items debugged");
> +SYSCTL_COUNTER_U64(_vm_debug, OID_AUTO, skipped, CTLFLAG_RD,
> + &uma_skip_cnt, "memory items skipped, not debugged");
> #endif
More information about the svn-src-head
mailing list