From owner-svn-src-all@freebsd.org Fri Jun 8 05:07:06 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B58DE1010316; Fri, 8 Jun 2018 05:07:06 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mail-pl0-x22f.google.com (mail-pl0-x22f.google.com [IPv6:2607:f8b0:400e:c01::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 38C2072CD6; Fri, 8 Jun 2018 05:07:06 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mail-pl0-x22f.google.com with SMTP id n10-v6so7550750plp.0; Thu, 07 Jun 2018 22:07:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:reply-to:subject:to:references:from:openpgp:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=TIhD9pDDsZJf/6lkeUXmuRbfBBreVMXjuA+FrRBf2k8=; b=eZh/9ltb8elRYX9G0lMg2D1gJPEjRAaHOKRgW3TjrR8i2Xi/dU/nJo/gFHvo85ffzM dTJdrYRgCTv94XiEnCLPqVdEkKSiVdNjyK0jFCn2ZPDTobRYSyuMlyO9guNKG4fNUpE9 xViUv9S5ktp2c1L75K7cqkZ4h57dlRp/L3WPRSSDKDB4mcsvXFE9PQJMm3m2dOhzXvU6 fGdESDwIRcZFepjwzUuHmAclSvIQdZKLX9+e7SypiCv2ODUd7VrYOFynFjF//Qn6enKx v7Ks8ikXwEzsJzcltLVzzlBkzpkrwJWGltXoTKSw9x4nSVTwOLhncGsnm9zzCpdQpzey YD1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:subject:to:references:from :openpgp:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=TIhD9pDDsZJf/6lkeUXmuRbfBBreVMXjuA+FrRBf2k8=; b=qk0GD0+gfhTSUGnme67oidQ9BzJinLoVUGHB0isJ4rI1iOyKbSjVtr4DWTvp/EqaKx VGafd8uEOYIR4o2HevJ92uo6U51lzfxoaj3EFbMtaIYkvicdO/DfWX+IdbjBJwefcQAY MM2nx/gA3AKUhuPAuAne+lgdY7/+CQM+eWdyU1t4dSqMXGpJZ98gGLGSPpyBC/bTRUKs aPD3dVTARYpI5GOZOZkb9PJW5swrnBc4z10DOjBqb6ou8NRBGCmCSzd6u195BpXH4Etg 76FvDftHrPuogGxWA+Xn21TLS4FV/uuAyIt32f/KU1Kk37gSE03fgTtQ7WBlTfQcokdU 6DyQ== X-Gm-Message-State: APt69E0pM+6rtY4IJKSHKliJ6M/orblMwpb/NSbbpOFSLI2kecX/Zny6 YKuUej4GAHqfLD2xmPuYPLyvpTXX X-Google-Smtp-Source: ADUXVKIWLAz95T/xwb0ze/uXL5dlzqvtJDbIf79pep4X98Cw4WQdHSyz12AFlEFj2WdEZLHGKtVG4A== X-Received: by 2002:a17:902:7c8b:: with SMTP id y11-v6mr2325295pll.222.1528434425016; Thu, 07 Jun 2018 22:07:05 -0700 (PDT) Received: from [192.168.1.102] (116.133.220.111.sta.wbroadband.net.au. [111.220.133.116]) by smtp.gmail.com with ESMTPSA id c4-v6sm24814835pgv.86.2018.06.07.22.07.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Jun 2018 22:07:04 -0700 (PDT) Sender: Kubilay Kocak Reply-To: koobs@FreeBSD.org Subject: Re: svn commit: r334819 - head/sys/vm To: Gleb Smirnoff , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201806080015.w580F8fM062154@repo.freebsd.org> From: Kubilay Kocak Openpgp: preference=signencrypt Message-ID: <77e67765-4244-e207-ff8d-aa6156c985b8@FreeBSD.org> Date: Fri, 8 Jun 2018 15:07:07 +1000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <201806080015.w580F8fM062154@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jun 2018 05:07:07 -0000 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