Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Jun 2018 15:07:07 +1000
From:      Kubilay Kocak <koobs@FreeBSD.org>
To:        Gleb Smirnoff <glebius@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r334819 - head/sys/vm
Message-ID:  <77e67765-4244-e207-ff8d-aa6156c985b8@FreeBSD.org>
In-Reply-To: <201806080015.w580F8fM062154@repo.freebsd.org>
References:  <201806080015.w580F8fM062154@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?77e67765-4244-e207-ff8d-aa6156c985b8>